Note that there are some explanatory texts on larger screens.

plurals
  1. POSub Navigation Bar with Hover Images
    primarykey
    data
    text
    <p>I am creating a horizontal top navigation bar with images. I have the top bar ready to go (code below) but I am unsure of how to add the second and third level of navigation. For instance, when someone hovers over Business Essentials I would like the image itself to change to it's hover state, as well as display a table below it which is my sub-navigation. Perhaps I'm going about this the wrong way, but using images is the only way I can get the exact look requested. If anyone can tell me what my next step should be or give me a reference/example code it would be GREATLY appreciated.</p> <pre><code>&lt;head&gt; &lt;script type="text/javascript"&gt; function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&amp;&amp;i&lt;a.length&amp;&amp;(x=a[i])&amp;&amp;x.oSrc;i++) x.src=x.oSrc; } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i&lt;a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))&gt;0&amp;&amp;parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&amp;&amp;d.all) x=d.all[n]; for (i=0;!x&amp;&amp;i&lt;d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&amp;&amp;d.layers&amp;&amp;i&lt;d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x &amp;&amp; d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i&lt;(a.length- 2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } &lt;/script&gt; &lt;/head&gt; &lt;body onload="MM_preloadImages('Nav2_hover.jpg','Nav3_hover.jpg','Nav4_hover.jpg','Nav5_hover.jpg','Nav6_hover.jpg','Nav7_hover.jpg','Nav8_hover.jpg','Nav9_hover.jpg')"&gt; &lt;table width="950" border="0" cellspacing="0" cellpadding="0"&gt; &lt;tr&gt; &lt;td width="194"&gt;&lt;img src="Nav1.jpg" width="194" height="67" alt="Home" longdesc="/home.aspx" /&gt;&lt;/td&gt; &lt;td width="70"&gt;&lt;a href="/bus_essentials.aspx" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('BusEssentials','','Nav2_hover.jpg',1)"&gt;&lt;img src="Nav2.jpg" alt="Business Essentials" width="70" height="67" id="BusEssentials" /&gt;&lt;/a&gt;&lt;/td&gt; &lt;td width="9"&gt;&lt;img src="NavDiv.jpg" width="9" height="67" /&gt;&lt;/td&gt; &lt;td width="68"&gt;&lt;a href="/career_planning.aspx" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('CareerPlanning','','Nav3_hover.jpg',1)"&gt;&lt;img src="Nav3.jpg" alt="Career Planning" width="68" height="67" id="CareerPlanning" /&gt;&lt;/a&gt;&lt;/td&gt; &lt;td width="9"&gt;&lt;img src="NavDiv.jpg" width="9" height="67" /&gt;&lt;/td&gt; &lt;td width="108"&gt;&lt;a href="/communications.aspx" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Communications','','Nav4_hover.jpg',1)"&gt;&lt;img src="Nav4.jpg" alt="Communications" width="108" height="67" id="Communications" /&gt;&lt;/a&gt;&lt;/td&gt; &lt;td width="9"&gt;&lt;img src="NavDiv.jpg" width="9" height="67" /&gt;&lt;/td&gt; &lt;td width="95"&gt;&lt;a href="/ind_effectiveness.aspx" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('IndivEffectiveness','','Nav5_hover.jpg',1)"&gt;&lt;img src="Nav5.jpg" alt="Individual Effectiveness" width="95" height="67" id="IndivEffectiveness" /&gt;&lt;/a&gt;&lt;/td&gt; &lt;td width="9"&gt;&lt;img src="NavDiv.jpg" width="9" height="67" /&gt;&lt;/td&gt; &lt;td width="84"&gt;&lt;a href="/leadership.aspx" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Leadership','','Nav6_hover.jpg',1)"&gt;&lt;img src="Nav6.jpg" alt="Leadership" width="84" height="67" id="Leadership" /&gt;&lt;/a&gt;&lt;/td&gt; &lt;td width="10"&gt;&lt;img src="NavDiv.jpg" width="9" height="67" /&gt;&lt;/td&gt; &lt;td width="77"&gt;&lt;a href="/mentoring.aspx" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Mentoring','','Nav7_hover.jpg',1)"&gt;&lt;img src="Nav7.jpg" alt="Mentoring" width="77" height="67" id="Mentoring" /&gt;&lt;/a&gt;&lt;/td&gt; &lt;td width="182"&gt;&lt;img src="NavDiv.jpg" width="9" height="67" /&gt;&lt;/td&gt; &lt;td width="9"&gt;&lt;a href="/effectiveness.aspx" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Effectiveness','','Nav8_hover.jpg',1)"&gt;&lt;img src="Nav8.jpg" alt="Effectiveness" width="99" height="67" id="Effectiveness" /&gt;&lt;/a&gt;&lt;/td&gt; &lt;td width="182"&gt;&lt;img src="NavDiv.jpg" width="9" height="67" /&gt;&lt;/td&gt; &lt;td width="17"&gt;&lt;a href="/skills.aspx" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Skills','','Nav9_hover.jpg',1)"&gt;&lt;img src="Nav9.jpg" alt="Skills" width="93" height="67" id="Skills" /&gt;&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload