首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

JavaScript下拉菜单有关问题

2012-01-23 
JavaScript下拉菜单问题!DOCTYPEhtmlPUBLIC-//W3C//DTDXHTML1.0Transitional//EN http://www.w3.org/T

JavaScript下拉菜单问题
<!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=gb2312 "   />
<title> 下拉菜单 </title>
<script   type= "text/javascript ">
<!--
va   theShowLayIndex   =   0;
function   showSubMenu(theIndex)
{
alert( "zx ");
var   subLay;
for(var   i=1;i <5;i++)
{
subLay   =   "lay "   +   i;
document.getElementById(subLay).style.visibility   =   "hidden ";
}
subLay   =   "lay "   +   i;
document.getElementById(subLay).style.visibility   =   "visible ";
document.getElementById(subLay).style.top   =   parseInt(document.getElementById( "lay0 ").style.top)   +   document.getElementById( "lay0 ").clientHeight;
theShowLayIndex   =   theIndex;
}
function   hideSubMenu(theIndex)
{
var   subLau   =   "lay "   +   theIndex;
document.getElementById(subLay).style.visibility   =   "hidden ";
}
function   hideLay()
{
alert( "zx ");
var   theShowLay   =   "lay "   +   theShowLayIndex;
var   theX1   =   parseInt(document.getElementById(theShowLay).style.left);
var   theX2   =   theX1   +   document.getElementById(theShowLay).clientWidth;
var   theY1   =   parseInt(document.getElementById( "lay0 ").style.top);
var   theY2   =   theY1   +   document.getElementById( "lay0 ").clientHeight   +   document.getElementById(theShowLay).clientHeight;
if(event.clientX   <   theX1   ||   event.clientX   >   theX2   ||   event.clientY   <   theY1   ||event.clientY   >   theY2)
{
for(var   i=1;i <5;i++)
{
subLay   =   "lay "   +   i;
document.getElementById(subLay).style.visibility   =   "hidden ";
}
}
}
//-->
</script>
</head>

<body>
<img   src= "top.gif "   />
<br   />
<div   id= "lay0 "   style= "position:absolute;   top:90px; ">
<table   width= "100% "   id= "theMenu "   cellpadding= "0 "   cellspacing= "0 "   bgcolor= "#BEC8F0 "   style= "border-bottom:1px   solid   #CCCCCC; ">
<tr>
<td>
<table>
<tr>
<td   width= "100px "> &nbsp; </td>
<td   id= "td1 "   onmouseover= "showSubMenu( '1 '); "> &nbsp;
<a   href= "http://www.sohu.com "> 学院概况&nbsp; </a>
</td>
<td   id= "td2 "   onmouseover= "showSubMenu(2); "> &nbsp;
<a   href= "http://www.sohu.com "> 学院建设&nbsp;
</td>
<td   id= "td3 "   onmouseover= "showSubMenu(3); "> &nbsp;


<a   href= "http://www.sohu.com "> 教师园地&nbsp; </a>
</td>
<td   id= "td4 "   onmouseover= "showSubMenu(4); "> &nbsp;
<a   href= "http://www.sohu.com "> 学院园地&nbsp; </a>
</td>
<td   id= "td5 "> &nbsp; </td>
</tr>
</table>
</td>
</tr>
</table>
</div>

<div   id= "lay1 "   style= "position:absolute;   top:0px;   left:125px;   visibility:hidden;   z-index:3;   line-height:18px; ">
<a   href= "http://www.sohu.com "   onclick= "hideSubMenu(1); "   target= "right "> 学院简介 </a> <br   />
<a   href= "http://www.sohu.com "   onclick= "hideSubMenu(1); "   target= "right "> 专业分类 </a> <br   />
</div>
<div   id= "lay2 "   style= "position:absolute;   top:0px;   left:190px;   visibility:hidden;   z-index:3;   line-height:18px; ">
<a   href= "http://www.sohu.com "   onclick= "hideSubMenu(2); "   target= "right "> 计算机应用 </a> <br   />
<a   href= "http://www.sohu.com "   onclick= "hideSubMenu(2); "   target= "right "> 计算机通信 </a> <br   />
<a   href= "http://www.sohu.com "   onclick= "hideSubMenu(2); "   target= "right "> 计算机工程 </a> <br   />
<a   href= "http://www.sohu.com "   onclick= "hideSubMenu(2); "   target= "right "> 计算机网络 </a> <br   />
<br   />
</div>
<div   id= "lay3 "   style= "position:absolute;   top:0px;   left:255px;   visibility:hidden;   z-index:3;   line-height:18px; ">
<a   href= "http://www.sohu.com "   onclick= "hideSubMenu(3); "   target= "right "> 教师主页 </a> <br   />
<a   href= "http://www.sohu.com "   onclick= "hideSubMenu(3); "   target= "right "> 上传成绩 </a> <br   />
<a   href= "http://www.sohu.com "   onclick= "hideSubMenu(3); "   target= "right "> 在线答疑 </a> <br   />
<a   href= "http://www.sohu.com "   onclick= "hideSubMenu(3); "   target= "right "> 教学公告 </a> <br   />
</div>
<div   id= "lay4 "   style= "position:absolute;   top:0px;   left:320px;   visibility:hidden;   z-index:3;   line-height:18px; ">
<a   href= "http://www.sohu.com "   onclick= "hideSubMenu(4); "   target= "right "> 学分查询 </a> <br   />
<a   href= "http://www.sohu.com "   onclick= "hideSubMenu(4); "   target= "right "> 成绩查询 </a> <br   />
<a   href= "http://www.sohu.com "   onclick= "hideSubMenu(4); "   target= "right "> 选课 </a> <br   />
<a   href= "http://www.sohu.com "   onclick= "hideSubMenu(4); "   target= "right "> 课表查询 </a> <br   />
</div>
</body>
</html>



各位帮我看看那里有问题,修改一下下

[解决办法]
是不是相对路径错了呢?
IE报告什么错恩?

不管如何,帮顶
[解决办法]
这怎么看啊,没有错误信息.又这么长
[解决办法]
看着都晕 怎么找啊 感觉还是路径问题。

热点排行