<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<ul id="u"><li id="first"></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li></ul>
<script>
window.onload=function(){
var ul=document.getElementById('u'),
x=document.getElementById('first'),
i=0,
lis=new Array()
while (x) {
lis[i].push(x.nextSibling);
i++;
x=x.nextSibling;
}
}
</script>
</body>
</html>
浏览器总是提示这个Cannot read property 'push' of undefined
at window.onload (test.html:21),js中不是能直接用push方法的么
相关分类