2012-07-12 52 views
0

我正在創建帶圖像的水平頂部導航欄。我準備好了頂級欄(下面的代碼),但我不確定如何添加第二級和第三級導航。例如,當某人懸停在Business Essentials上時,我希望圖像本身可以更改爲懸停狀態,並在其下方顯示一個表,這是我的子導航。也許我會以錯誤的方式去解決這個問題,但使用圖像是我能夠得到所需確切外觀的唯一方法。如果有人能告訴我我的下一步應該是什麼,或給我一個參考/示例代碼,它將非常感激。帶有懸停圖像的子導航欄

<head> 
<script type="text/javascript"> 
function MM_swapImgRestore() { //v3.0 
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&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<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("?"))>0&&parent.frames.length) { 
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} 
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; 
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); 
if(!x && 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<(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];} 
} 
</script> 
</head> 


<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')"> 

<table width="950" border="0" cellspacing="0" cellpadding="0"> 
<tr> 
<td width="194"><img src="Nav1.jpg" width="194" height="67" alt="Home" longdesc="/home.aspx" /></td> 
<td width="70"><a href="/bus_essentials.aspx" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('BusEssentials','','Nav2_hover.jpg',1)"><img src="Nav2.jpg" alt="Business Essentials" width="70" height="67" id="BusEssentials" /></a></td> 
<td width="9"><img src="NavDiv.jpg" width="9" height="67" /></td> 
<td width="68"><a href="/career_planning.aspx" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('CareerPlanning','','Nav3_hover.jpg',1)"><img src="Nav3.jpg" alt="Career Planning" width="68" height="67" id="CareerPlanning" /></a></td> 
<td width="9"><img src="NavDiv.jpg" width="9" height="67" /></td> 
<td width="108"><a href="/communications.aspx" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Communications','','Nav4_hover.jpg',1)"><img src="Nav4.jpg" alt="Communications" width="108" height="67" id="Communications" /></a></td> 
<td width="9"><img src="NavDiv.jpg" width="9" height="67" /></td> 
<td width="95"><a href="/ind_effectiveness.aspx" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('IndivEffectiveness','','Nav5_hover.jpg',1)"><img src="Nav5.jpg" alt="Individual Effectiveness" width="95" height="67" id="IndivEffectiveness" /></a></td> 
<td width="9"><img src="NavDiv.jpg" width="9" height="67" /></td> 
<td width="84"><a href="/leadership.aspx" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Leadership','','Nav6_hover.jpg',1)"><img src="Nav6.jpg" alt="Leadership" width="84" height="67" id="Leadership" /></a></td> 
<td width="10"><img src="NavDiv.jpg" width="9" height="67" /></td> 
<td width="77"><a href="/mentoring.aspx" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Mentoring','','Nav7_hover.jpg',1)"><img src="Nav7.jpg" alt="Mentoring" width="77" height="67" id="Mentoring" /></a></td> 
<td width="182"><img src="NavDiv.jpg" width="9" height="67" /></td> 
<td width="9"><a href="/effectiveness.aspx" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Effectiveness','','Nav8_hover.jpg',1)"><img src="Nav8.jpg" alt="Effectiveness" width="99" height="67" id="Effectiveness" /></a></td> 
<td width="182"><img src="NavDiv.jpg" width="9" height="67" /></td> 
<td width="17"><a href="/skills.aspx" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Skills','','Nav9_hover.jpg',1)"><img src="Nav9.jpg" alt="Skills" width="93" height="67" id="Skills" /></a></td> 
</tr> 
</table> 
+0

我還沒有看到Dreamweaver的年齡中生成的菜單。而你不應該要麼使用它。只需搜索一個很好的語義CSS菜單 – 2012-07-12 19:45:05

回答