用Javascript写的下拉菜单
<div class="operation">
<h4>我的
下拉菜单</h4>
<div id="favorite">
</div>
<script LANGUAGE="Javascript">
<!-- Begin
cat = new Array();
cat[0] = "Java程序设计";
cat[1] = "优秀的开源软件";
cat[2] = "有用的工具软件";
cat[3] = "Linux操作系统";
cat[4] = "日语学习";
cat[5] = "英语学习";
cat[6] = "有用站点";
cat[7] = "博客";
links=new Array();
links[0]=new Array();
links[0][0]=new link("http://java.sun.com","Java Technology");
links[0][1]=new link("http://www.eclipse.org","Eclipse org Main Page");
links[0][2]=new link("http://www.sourceforge.net","SoruceForge.net");
links[0][3]=new link("http://www.javaranch.com/","JavaRanch");
links[0][4]=new link("http://www.theserverside.com/tss","TheServerSide.com");
links[0][5]=new link("http://freshmeat.net/","FreshMeat");
links[0][6]=new link("http://www.javaworld.com/","JavaWorld");
links[1]=new Array();
links[1][0]=new link("http://azureus.sourceforge.net/","Azureus");
links[1][1]=new link("http://lumaqq.linuxsir.org/main/?q=node/231","LumaQQ");
links[1][1]=new link("http://ant.apache.org/","Ant自动化工具");
links[1][2]=new link("http://db.apache.org/derby/index.html","The Apache DB Project");
links[1][3]=new link("http://www.apache.org/","The Apache Software Foundation");
links[1][4]=new link("http://www.ofbiz.org/","Open for Business");
links[1][5]=new link("http://argouml.tigris.org/","ArgoUML");
links[2]=new Array();
links[3]=new Array();
links[4]=new Array();
links[4][0]=new link("http://www.hjbbs.com","沪江论坛");
links[4][1]=new link("http://bbs.hzmjp.com/","现代日语学习论坛");
links[4][1]=new link("http://www.chnjp.com","在日生活网");
links[4][2]=new link("http://www.etransc.com/edictionary.htm","网上字典资源");
links[4][3]=new link("http://chat.sina.com.cn/homepage/topic_index.shtml?topic4100_room_list","新浪日语聊天室");
links[5]=new Array();
links[5][0]=new link("http://www.listeningexpress.net","英语听力特快");
links[6]=new Array();
links[6][0]=new link("http://www.20Q.net","20Q.net");
links[6][1]=new link("http://www.core.org.cn/cn/","中国开放式教育资源共享协会");
links[6][2]=new link("http://chinavr.net/21.htm","中国的世界遗产");
links[6][3]=new link("http://www.newjobs.com.cn/","中国国家人才网");
links[6][4]=new link("http://www.kepu.com.cn/gb/index.html","中国科普博览");
links[6][5]=new link("http://www.cnphotos.net/","中国摄影网主页");
links[6][6]=new link("http://www.cns911.com/news/hacker/list.php","中国网络安全响应中心");
links[6][7]=new link("http://www.cma-mh.org/","中华精神卫生网");
links[7]=new Array();
links[7][0]=new link("http://spaces.msn.com/members/yuanunlimited/PersonalSpace.aspx","A lovely and clevel girl :)");
links[7][1]=new link("http://spaces.msn.com/members/dendsx","土豆泥大厦");
links[7][2]=new link("http://spaces.msn.com/members/beesheer/","Drowning Frog");
//*********************************************************************
generate();
function link(href,desc)
{
this.href=href;
this.desc=desc;
}
function generate()
{
var htmlString = "<table class=\"myFont\" border=1 cellspacing=0 bordercolor=#1070a0 width=200>";
for(var j=0;j<cat.length;j++) {
htmlString += "<tr><td bgcolor=#2779cb align=left onmouseover=\"submenu" + j + ".style.display='block';\" onmouseout=\"submenu" + j + ".style.display='none';\"><img src=\"image/tline.gif\" border=0 id=bar" + j + " width=11 height=11> " + cat[j] + "</td></tr><tr>";
htmlString += "<td align=left onmouseover=\"submenu" + j + ".style.display='block';\" onmouseout=\"submenu" + j + ".style.display='none'\">";
htmlString += "<span id=submenu" + j + " style=\"DISPLAY:none;MARGIN-LEFT:5px\">";
for(var i=0;i<links[j].length;i++) {
htmlString += "<a href=\"" + links[j][i].href + "\" target=ZhuFrame>" + links[j][i].desc + "</a><br>";
}
htmlString += "</span></td></tr>";
}
htmlString += "</table>";
favorite.innerHTML = htmlString;
}
// End -->
</script>
</div>