<!doctype html> <html> <head> <meta charset="utf-8"> <title>无标题文档</title> <script type="text/ecmascript" src="js/js2.js"></script> <link rel="stylesheet" href="css/17.css"> </head> <div id="ybl"> <ul> <li><a href="#">首页</a></li> <li><a href="#">专业建设</a> <ul> <li><a href="#">建设目标</a></li> <li><a href="#">建设思路</a></li> <li><a href="#">培养方案</a></li> </ul> </li> <li><a href="#">师资队伍</a> <ul> <li><a href="#"> 负责人</a></li> <li><a href="#">队伍结构</a></li> <li><a href="#">任课教师</a></li> <li><a href="#">教学管理</a></li> <li><a href="#">合作办学</a></li> </ul> </li> <li><a href="#">教学条件</a> <ul> <li><a href="#">经费投入</a></li> <li><a href="#">实践教学</a></li> <li><a href="#">教材改革</a></li> </ul> </li> <li><a href="#">改革建设</a> <ul> <li><a href="#">课程改革</a></li> <li><a href="#">教材改革</a></li> </ul> </div> <body> </body> </html>
// JavaScript Document
function windowLoad() {
var lis = document.getElementById("menu").getElementsByTagName("li");
for (var i = 0; i <lis.length; i++){
lis [i].onmouseover = function() {
this.className += (this.className.length >0?"":"") +"sfhover"
}
lis[i].onmouseout = function ()
{
this.className = this.className.replace("sfhover","");
}
}
}
window.onload = windowLoad; //窗口加载成功后执行 windoLoad 函数@charset "utf-8";
/* CSS Document */
body
{
font-family: "宋体";
font-size: 12px;
line-height: 1.5em;
}
#ybl
{ width:500px;
height:28px;
margin:0 auto;
border-bottom: 3px solid #e10001;
}
#ybl ul
{
list-style:none;
margin:0px;
padding:0px;
}
#ybl ul li
{
float:left;
margin-left: 1px;
}
a
{
color:#000;
text-decoration: none;
}
a:hover
{
color: #F00;
}
#ybl ul li a
{
display: block;
width: 87px;
height: 28px;
line-height: 28px;
text-align: center;
background: url(../image/26.jpg) 0 0 repeat-x;
font-size: 14px;
}
#ybl ul li ul
{
border: 1px solid #ccc;
position:absolute;
display:none;
}
#ybl ul li ul li
{
float:none;
line-height:87px;
background: #eee;
margin: 0px;
}
#ybl ul li ul li a
{
background: none;
}
#ybl ul li ul li a:hover
{
background-color:#333;
color: #fff;
}
#ybl ul li:hover ul
{
display:block
}
#ybl ul li.sfhover ul
{
display: block;
}大神帮我看看JS哪里出错了。。Uncaught TypeError: Cannot read property 'getElementsByTagName' of null

qq_那就好_2
ExiaGo
习惯受伤
慕的地6079101
qq_歲月靜好不忘初心_0
忆昔何年
随时随地看视频慕课网APP