想用js代码实现多层的显隐,当鼠标移到相应链接的相应层即显示,其他层隐藏
js代码如下:
1<SCRIPT language=javascript>
2 function hidesubmenu(sid)
3 {
4 eval("submenu" + sid + ".style.display=\"none\";");
5 }
6 function showsubmenu(sid)
7 {
8 submenu1.style.display="none";
9 submenu2.style.display="none";
10 submenu3.style.display="none";
11 eval("submenu" + sid + ".style.display=\"block\";");
12 //eval("document.submenu" + sid + ".visibility=\"visible\";");
13 }
14</SCRIPT>
2 function hidesubmenu(sid)
3 {
4 eval("submenu" + sid + ".style.display=\"none\";");
5 }
6 function showsubmenu(sid)
7 {
8 submenu1.style.display="none";
9 submenu2.style.display="none";
10 submenu3.style.display="none";
11 eval("submenu" + sid + ".style.display=\"block\";");
12 //eval("document.submenu" + sid + ".visibility=\"visible\";");
13 }
14</SCRIPT>
html中对应代码如下:
1<span class="bold12"><a title="国内新闻" href="###" onmouseover="javascript:showsubmenu('1');">国内要闻</a></span>
2 <span class="bold12"><a title="财经新闻" href="###" onmouseover="javascript:showsubmenu('2');">财经新闻</a></span>
3 <span class="bold12"><a title="体育新闻" href="###" onmouseover="javascript:showsubmenu('3');">体育新闻</a></span>
4
5 <div id="submenu1" style="BORDER:1px dotted;DISPLAY: none; background:#ffffff;height:270px" ><script language="JavaScript1.1" src="http://paidip.china.com/freecode/out.php?typeid=945&num=10&t=2&f=12&c=000088&l=1"></script></div>
6 <div id="submenu2" style="BORDER:1px dotted;DISPLAY: none;background:#ffffff;height:270px" ><script language="JavaScript1.1" src="http://paidip.china.com/freecode/out.php?typeid=11009723&num=10&t=2&f=12&c=000088&l=1"></script></div>
7 <div id="submenu3" style="BORDER:1px dotted;background:#ffffff;DISPLAY: none;height:270px" ><script language="JavaScript1.1" src="http://paidip.china.com/freecode/out.php?typeid=10002913&num=10&t=2&f=12&c=FF0000&l=1"></script></div>
8 <div id="submenu4" style="BORDER:1px dotted; DISPLAY: none;background:#ffffff;height:270px" ><script language="JavaScript1.1" src="http://paidip.china.com/freecode/out.php?typeid=444&num=10&t=2&f=12&c=000088&l=1"></script></div>
9 <div id="submenu5" style="BORDER:1px dotted;DISPLAY: none;background:#ffffff;height:270px" ><script language="JavaScript1.1" src="http://paidip.china.com/freecode/out.php?typeid=205&num=10&t=2&f=12&c=000088&l=1"></script></div>
10 <div id="submenu6" style="BORDER:1px dotted;background:#ffffff;DISPLAY: none;height:270px" ><script language="JavaScript1.1" src="http://paidip.china.com/freecode/out.php?typeid=1007&num=10&t=2&f=12&c=000088&l=1"></script></div>
11 <div id="submenu7" style="BORDER:1px dotted;background:#ffffff;height:270px" ><script language="JavaScript1.1" src="http://paidip.china.com/freecode/out.php?typeid=154&num=10&t=2&f=12&c=000088&l=1"></script></div>
2 <span class="bold12"><a title="财经新闻" href="###" onmouseover="javascript:showsubmenu('2');">财经新闻</a></span>
3 <span class="bold12"><a title="体育新闻" href="###" onmouseover="javascript:showsubmenu('3');">体育新闻</a></span>
4
5 <div id="submenu1" style="BORDER:1px dotted;DISPLAY: none; background:#ffffff;height:270px" ><script language="JavaScript1.1" src="http://paidip.china.com/freecode/out.php?typeid=945&num=10&t=2&f=12&c=000088&l=1"></script></div>
6 <div id="submenu2" style="BORDER:1px dotted;DISPLAY: none;background:#ffffff;height:270px" ><script language="JavaScript1.1" src="http://paidip.china.com/freecode/out.php?typeid=11009723&num=10&t=2&f=12&c=000088&l=1"></script></div>
7 <div id="submenu3" style="BORDER:1px dotted;background:#ffffff;DISPLAY: none;height:270px" ><script language="JavaScript1.1" src="http://paidip.china.com/freecode/out.php?typeid=10002913&num=10&t=2&f=12&c=FF0000&l=1"></script></div>
8 <div id="submenu4" style="BORDER:1px dotted; DISPLAY: none;background:#ffffff;height:270px" ><script language="JavaScript1.1" src="http://paidip.china.com/freecode/out.php?typeid=444&num=10&t=2&f=12&c=000088&l=1"></script></div>
9 <div id="submenu5" style="BORDER:1px dotted;DISPLAY: none;background:#ffffff;height:270px" ><script language="JavaScript1.1" src="http://paidip.china.com/freecode/out.php?typeid=205&num=10&t=2&f=12&c=000088&l=1"></script></div>
10 <div id="submenu6" style="BORDER:1px dotted;background:#ffffff;DISPLAY: none;height:270px" ><script language="JavaScript1.1" src="http://paidip.china.com/freecode/out.php?typeid=1007&num=10&t=2&f=12&c=000088&l=1"></script></div>
11 <div id="submenu7" style="BORDER:1px dotted;background:#ffffff;height:270px" ><script language="JavaScript1.1" src="http://paidip.china.com/freecode/out.php?typeid=154&num=10&t=2&f=12&c=000088&l=1"></script></div>