<!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方法的么
小問題,求助,求助,急!
lulubiu
2017-05-09 20:19:32