请高手指教如何能去掉最上面的定义
现在的问题是,最上面必须要先定义menu1,menu2,menu3这样,如何能将其去掉而照样正常显示。
可能问题出在show函数中,调用时x一直是undefined
第一次发贴,请高手多多指教
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns= "http://www.w3.org/1999/xhtml ">
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=utf-8 " />
<title> menu </title>
<style>
body{font-size:12px;}
a:link,a:visited{color:#313139;text-decoration:none;}
a:hover{color:#e80000;text-decoration:none;}
#Across{position:relative;height:25px;background:#888;}
#Across a{float:left;line-height:25px;height:25px;width:60px;text-align:center;}
.bg{background:#eee;}
/*#MenuDrop{border-top:1px solid #000;border-left:1px solid #000;border-right:1px solid #000;}*/
#MenuDrop a{float:left;width:100%;height:25px;background:#fcc;text-align:center;line-height:25px;}
#MenuDrop a:hover{background:#cff;}
</style>
</head>
<body>
<script>
var menu1,menu2,menu3//需要把这一行注释掉后仍然正常,谢谢
var menu=[
[ "门户网站 ", "menu1 ", ' <a href= "http://www.163.com " target= "_blank "> 网易 </a> ', ' <a href= "http://www.sina.com " target= "_blank "> 新浪 </a> ', ' <a href= "http://www.sohu.com " target= "_blank "> 搜狐 </a> ', ' <a href= "http://www.yahoo.com " target= "_blank "> 雅虎 </a> ', ' <a href= "http://www.baidu.com " target= "_blank "> 百度 </a> '],
[ "大论坛 ", "menu2 ", ' <a href= "default.html "> 天涯 </a> ', ' <a href= "# "> 猫扑 </a> ', ' <a href= "# "> 西祠 </a> ', ' <a href= "# "> 榕树 </a> '],
[ "兴趣 ", "menu3 ", ' <a href= "# "> 历史 </a> ', ' <a href= "# "> 化学 </a> ', ' <a href= "# "> 摄影 </a> ', ' <a href= "# "> 舞蹈 </a> ', ' <a href= "# "> 建筑 </a> ', ' <a href= "# "> 电脑 </a> ']
]
document.write( " <div id= 'Across '> ")
for(var i=0; i <menu.length; i++){
document.write( " <a href= 'default.html ' onclick= 'return false ' onmouseover= 'show( "+ menu[i][1]+ ", "+i+ ",this) ' onmouseout= 'delayHide() '> ");
document.write(menu[i][0]);
document.write( " </a> ");
}
document.write( " <div id= 'MenuDrop ' style= 'position:absolute;display:none;width:78px; ' onmouseover= 'clearDelay() ' onmouseout= 'delayHide() '> </div> ");
document.write( " </div> ");
function hide(){
document.getElementById( "MenuDrop ").style.display= "none ";
for(var i=0; i <document.getElementById( "Across ").getElementsByTagName( "A ").length; i++){