
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Green Complexjavascripts | Green Complex</title>
	<atom:link href="http://green.cx/tag/javascripts/feed/" rel="self" type="application/rss+xml" />
	<link>http://green.cx</link>
	<description></description>
	<lastBuildDate>Fri, 23 Dec 2011 17:12:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Web 2.0 Navigation Crash Course</title>
		<link>http://green.cx/web-resources/web-dev-resources/web-20-navigation-crash/</link>
		<comments>http://green.cx/web-resources/web-dev-resources/web-20-navigation-crash/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 05:38:26 +0000</pubDate>
		<dc:creator>+Jason</dc:creator>
				<category><![CDATA[Web 2.0]]></category>
		<category><![CDATA[Web Stuff]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[javascripts]]></category>
		<category><![CDATA[navigation]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://green.cx/?p=219</guid>
		<description><![CDATA[<img src="http://green.cx/wp-content/blogs.dir/1/category-images/5.original.png" width="659" height="87" alt="" title="Web 2.0" /><img src="http://green.cx/wp-content/blogs.dir/1/category-images/40.original.png" width="659" height="87" alt="" title="Web Stuff" /><br/>This is a beginners guide to creating a site-wide navigation that is consistent from page to page. Tired of keeping track of multiple Menu&#8217;s on different pages? As your site grows, adding 1 new page to 25 other pages&#8217; navigation can become a full time job. I&#8217;ll show you how easy it really is to make a single navigation [...]]]></description>
			<content:encoded><![CDATA[<img src="http://green.cx/wp-content/blogs.dir/1/category-images/5.original.png" width="659" height="87" alt="" title="Web 2.0" /><img src="http://green.cx/wp-content/blogs.dir/1/category-images/40.original.png" width="659" height="87" alt="" title="Web Stuff" /><br/><p><img class="alignleft size-full wp-image-246" title="HTML-DYNAMIC DRIVE NAV SAMPLE" src="http://green.cx/wp-content/uploads/2009/08/HTML-DYNAMIC-DRIVE-NAV.PNG" alt="HTML-DYNAMIC DRIVE NAV SAMPLE" width="255" height="60" />This is a beginners guide to creating a site-wide navigation that is consistent from page to page.</p>
<p>Tired of keeping track of multiple Menu&#8217;s on different pages? As your site grows, adding 1 new page to 25 other pages&#8217; navigation can become a full time job. I&#8217;ll show you how easy it really is to make a single navigation that will save you time and headaches!</p>
<p><span id="more-219"></span></p>
<p>For this you&#8217;ll need:</p>
<ol>
<li>Guts</li>
<li>A little understanding of <a id="aptureLink_YOwilLbj08" title='Original Link: http://en.wikipedia.org/wiki/Semantic%20HTML'  href="http://green.cx/?BrEyIimk">HTML</a> <a id="aptureLink_dmeBrsoC61" title='Original Link: http://en.wikipedia.org/wiki/Cascading%20Style%20Sheets'  href="http://green.cx/?RtmNoxhu">CSS</a> and <a id="aptureLink_EW4c0ojc3S" title='Original Link: http://en.wikipedia.org/wiki/PHP%20programming%20language'  href="http://green.cx/?hm2Ek4v2">PHP</a> (Not Really)</li>
<li><a id="aptureLink_5lXNHGm870" title='Original Link: http://en.wikipedia.org/wiki/Notepad%2B%2B'  href="http://green.cx/?LaH2GoE7">Notepad++</a> (Or any HTML editor)</li>
<li>A copy of <a title='Original Link: http://www.dynamicdrive.com/dynamicindex1/ddtabmenu.htm'  href="http://green.cx/?G8vegHoX">DDtabmenu</a> From Dynamic Drive (<a title='Original Link: http://www.dynamicdrive.com/dynamicindex1/ddtabmenu.zip'  href="http://green.cx/?1BAfYIA6">This file</a>)</li>
</ol>
<h2>1. Let&#8217;s start off with the code you&#8217;ll need. The Three Parts are:</h2>
<p><strong>A. The CSS include,  paste this in the header of your html.</strong></p>
<pre class="brush: html">&lt;link rel="stylesheet" type="text/css" href="/solidblocksmenu.css"&gt;</pre>
<p><strong>B. The <a id="aptureLink_hlJAdZYWTx" title='Original Link: http://en.wikipedia.org/wiki/JavaScript'  href="http://green.cx/?UsA5lWWX">Javascript</a> Magic,  paste this near the top of your html.</strong></p>
<pre class="brush: html">&lt;script type="text/javascript" src="/ddtabmenu.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;ddtabmenu.definemenu("ddtabs1", auto)
&lt;/script&gt;</pre>
<blockquote><p>To make adjustments, you can change the <strong>tab_menu_id </strong>to whatever HTML id your using for your menu, and the number after the comma will select which link is highlighted.<br />
SYNTAX: ddtabmenu.definemenu(&#8220;tab_menu_id&#8221;, integer OR &#8220;auto&#8221;)<br />
//initialize Tab Menu with ID &#8220;ddtabs1&#8243; and select 1st tab by default</p></blockquote>
<p><strong>C. The HTML for the <a title="Links" href="http://green.cx/links/">Links</a></strong></p>
<pre class="brush: html">&lt;div id="ddtabs1" class="basictab"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://green.cx/" rel="sc1"&gt;Home&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://green.cx/Link1.htm" rel="sc2"&gt;Link1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://green.cx/Link2/" rel="sc3"&gt;Link2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://green.cx/Link3/"&gt;Link3&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://green.cx/Link4"&gt;Link4&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;</pre>
<p><strong>D. The HTML for the Subtitles</strong></p>
<pre class="brush: html">&lt;DIV class="tabcontainer"&gt;

&lt;div id="sc1" class="tabcontent"&gt;Sub contents here&lt;/div&gt;
&lt;div id="sc2" class="tabcontent"&gt;Sub contents here&lt;/div&gt;
&lt;div id="sc3" class="tabcontent"&gt;Sub contents here&lt;/div&gt;

&lt;/DIV&gt;</pre>
<h2>2. Now The Required files you need on your server</h2>
<p>Download <a title='Original Link: http://www.dynamicdrive.com/dynamicindex1/ddtabmenu.zip'  href="http://green.cx/?1BAfYIA6">this file</a> and extract the contents to the root of your webserver, using a <a id="aptureLink_ZoCOVaGvcI" title='Original Link: http://en.wikipedia.org/wiki/List%20of%20FTP%20clients'  href="http://green.cx/?WtOrHiod">FTP client</a> like <a id="aptureLink_cUzzEVhefd" title='Original Link: http://en.wikipedia.org/wiki/FileZilla'  href="http://green.cx/?fJhlgw98">FileZilla</a>.</p>
<p>And, Volia! You should have a nice HTML/CSS Navigation on your site, but you don&#8217;t want to copy/paste this to EVERY page on your site right?<br />
What if you needed to change a link or fix a typo? That would be a LOT of editing for a site with more than a hand full  of pages.</p>
<p>So we get around that using a simple PHP include file.</p>
<p>Woah! Don&#8217;t get nervous, this is actually really easy, just keep following along!</p>
<p>Now making that nice flashy menu and making it a PHP include is really quite easy.</p>
<p>First off I feel the need to make it clear, your server needs to support PHP. (Of course)</p>
<p>Start off Coping the HTML code for the MENU and the Subtitles, into a new document, named <em>nav.inc</em></p>
<p><strong><em>nav.inc</em></strong> Contents</p>
<pre class="brush: html">&lt;div id="ddtabs1"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://green.cx/" rel="sc1"&gt;Home&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://green.cx/Link1.htm" rel="sc2"&gt;Link1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://green.cx/Link2/" rel="sc3"&gt;Link2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://green.cx/Link3/"&gt;Link3&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://green.cx/Link4"&gt;Link4&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;DIV&gt;
&lt;div id="sc1"&gt;Sub contents here&lt;/div&gt;
&lt;div id="sc2"&gt;Sub contents here&lt;/div&gt;
&lt;div id="sc3"&gt;Sub contents here&lt;/div&gt;
&lt;/DIV&gt;</pre>
<p>Now rename your index.html file to index.php</p>
<p>Keep the CSS and Javascript in the header as per usual.</p>
<p>But where the Menu was located, replace it with this code.</p>
<pre class="brush: php">&lt;?php
include ("/nav.inc");
?&gt;</pre>
<p>That should put the contents of the navigation include file whenever this line is called. But notice! It will only work when the index (or any file on the server) ends with .php</p>
<p>Give it a try!</p>
<p><!--pre class="brush: javascript"><br />
//DD Tab Menu- Script rewritten April 27th, 07: http://www.dynamicdrive.com<br />
//**Updated Feb 23rd, 08): Adds ability for menu to revert back to default selected tab when mouse moves out of menu</p>
<p>//Only 2 configuration variables below:</p>
<p>var ddtabmenu={<br />
disabletablinks: false, //Disable hyperlinks in 1st level tabs with sub contents (true or false)?<br />
snap2original: [true, 300], //Should tab revert back to default selected when mouse moves out of menu? ([true/false, delay_millisec]</p>
<p>currentpageurl: window.location.href.replace(&#8220;http://&#8221;+window.location.hostname, &#8220;&#8221;).replace(/^//, &#8220;&#8221;), //get current page url (minus hostname, ie: http://www.dynamicdrive.com/)</p>
<p>definemenu:function(tabid, dselected){<br />
this[tabid+"-menuitems"]=null<br />
this[tabid+"-dselected"]=-1<br />
this.addEvent(window, function(){ddtabmenu.init(tabid, dselected)}, &#8220;load&#8221;)<br />
},</p>
<p>showsubmenu:function(tabid, targetitem){<br />
var menuitems=this[tabid+"-menuitems"]<br />
this.clearrevert2default(tabid)<br />
for (i=0; i&lt;menuitems.length; i++){<br />
menuitems[i].className=&#8221;"<br />
if (typeof menuitems[i].hasSubContent!=&#8221;undefined&#8221;)<br />
document.getElementById(menuitems[i].getAttribute(&#8220;rel&#8221;)).style.display=&#8221;none&#8221;<br />
}<br />
targetitem.className=&#8221;current&#8221;<br />
if (typeof targetitem.hasSubContent!=&#8221;undefined&#8221;)<br />
document.getElementById(targetitem.getAttribute(&#8220;rel&#8221;)).style.display=&#8221;block&#8221;<br />
},</p>
<p>isSelected:function(menuurl){<br />
var menuurl=menuurl.replace(&#8220;http://&#8221;+menuurl.hostname, &#8220;&#8221;).replace(/^//, &#8220;&#8221;)<br />
return (ddtabmenu.currentpageurl==menuurl)<br />
},</p>
<p>isContained:function(m, e){<br />
var e=window.event || e<br />
var c=e.relatedTarget || ((e.type==&#8221;mouseover&#8221;)? e.fromElement : e.toElement)<br />
while (c &amp;&amp; c!=m)try {c=c.parentNode} catch(e){c=m}<br />
if (c==m)<br />
return true<br />
else<br />
return false<br />
},</p>
<p>revert2default:function(outobj, tabid, e){<br />
if (!ddtabmenu.isContained(outobj, tabid, e)){<br />
window["hidetimer_"+tabid]=setTimeout(function(){<br />
ddtabmenu.showsubmenu(tabid, ddtabmenu[tabid+"-dselected"])<br />
}, ddtabmenu.snap2original[1])<br />
}<br />
},</p>
<p>clearrevert2default:function(tabid){<br />
if (typeof window["hidetimer_"+tabid]!=&#8221;undefined&#8221;)<br />
clearTimeout(window["hidetimer_"+tabid])<br />
},</p>
<p>addEvent:function(target, functionref, tasktype){ //assign a function to execute to an event handler (ie: onunload)<br />
var tasktype=(window.addEventListener)? tasktype : &#8220;on&#8221;+tasktype<br />
if (target.addEventListener)<br />
target.addEventListener(tasktype, functionref, false)<br />
else if (target.attachEvent)<br />
target.attachEvent(tasktype, functionref)<br />
},</p>
<p>init:function(tabid, dselected){<br />
var menuitems=document.getElementById(tabid).getElementsByTagName(&#8220;a&#8221;)<br />
this[tabid+"-menuitems"]=menuitems<br />
for (var x=0; x&lt;menuitems.length; x++){<br />
if (menuitems[x].getAttribute(&#8220;rel&#8221;)){<br />
this[tabid+"-menuitems"][x].hasSubContent=true<br />
if (ddtabmenu.disabletablinks)<br />
menuitems[x].onclick=function(){return false}<br />
if (ddtabmenu.snap2original[0]==true){<br />
var submenu=document.getElementById(menuitems[x].getAttribute(&#8220;rel&#8221;))<br />
menuitems[x].onmouseout=function(e){ddtabmenu.revert2default(submenu, tabid, e)}<br />
submenu.onmouseover=function(){ddtabmenu.clearrevert2default(tabid)}<br />
submenu.onmouseout=function(e){ddtabmenu.revert2default(this, tabid, e)}<br />
}<br />
}<br />
else //for items without a submenu, add onMouseout effect<br />
menuitems[x].onmouseout=function(e){this.className=&#8221;"; if (ddtabmenu.snap2original[0]==true) ddtabmenu.revert2default(this, tabid, e)}<br />
menuitems[x].onmouseover=function(){ddtabmenu.showsubmenu(tabid, this)}<br />
if (dselected==&#8221;auto&#8221; &amp;&amp; typeof setalready==&#8221;undefined&#8221; &amp;&amp; this.isSelected(menuitems[x].href)){<br />
ddtabmenu.showsubmenu(tabid, menuitems[x])<br />
this[tabid+"-dselected"]=menuitems[x]<br />
var setalready=true<br />
}<br />
else if (parseInt(dselected)==x){<br />
ddtabmenu.showsubmenu(tabid, menuitems[x])<br />
this[tabid+"-dselected"]=menuitems[x]<br />
}<br />
}<br />
}<br />
}</pre-->]]></content:encoded>
			<wfw:commentRss>http://green.cx/web-resources/web-dev-resources/web-20-navigation-crash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using apc
Database Caching 117/168 queries in 0.245 seconds using apc

Served from: potpiedeluxe.com @ 2012-02-09 19:01:26 -->
