日期:2014-05-16 浏览次数:20399 次
<!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" /> <style type="text/css"> #a_div { line-height:25px;font-weight:600;color:blue;width:200px;} #a_div ul { display:none;text-decoration:none;margin:0px;color:black;} #a_div.ch_div { color:red;} #a_div ul.ch_ul { display:block;} #a_div ul li.ch_li { color:red;position:relative;} #a_div ul li.ch_li ul { display:block;position:absolute;top:0px;} </style> <script type="text/javascript"> start=function() { var a=document.getElementById("a_div"); var b=a.getElementsByTagName("ul"); var c=a.getElementsByTagName("li"); a.onmouseover=function(){ this.className="ch_div";b[0].className="ch_ul";} a.onmouseout=function(){ this.className="";b[0].className="";} for(i=0;i<c.length;i++){ c[i].onmouseover=function(){ this.className="ch_li";}} for(i=0;i<c.length;i++){ c[i].onmouseout=function(){ this.className="";}} } window.onload=start; </script> </head> <body> <div id="a_div" >导航 <ul> <li>内容1</li> <li>内容2</li> <li>内容3 <ul> <li>内容4</li> <li>内容5</li> </ul> </ul> </div> </body> </html>