나는이 코드를 가지고있다. 오류가 발생했습니다. document.getElementById ('foo')가 null입니다. 이 문제를 도와주세요.document.getElementById() is null
<script>
function doMove() {
var foo=document.getElementById('foo');
foo.style.left = (foo.style.left+10)+'px'; // pseudo-property code: Move right by 10px
setTimeout(doMove(),20); // call doMove() in 20 msec
}
doMove();
</script>
</head>
<body>
<div id="foo" style="width:10px;">a</div>
</body>
</html>
가능한 중복 [이유는 무엇입니까 jQuery를 또는 \ '에서 getElementById는 \'하지 요소를 찾을 같은 DOM 방법은?] (http://stackoverflow.com/questions/14028959/why-does-jquery-or -a-dom-method-like-getelementbyid-not-find-the-element) – VisioN
이 질문을하기 전에 검색했을 때 (그렇게 했습니까?) 정말로 357 번 이전의 "Why is 'document.getElementById'는'null' 질문과 그 답을 돌려 주나요? –
[link] http://stackoverflow.com/questions/14028959/why-does-jquery-or-a-dom-method-such-as-getelementbyid-not-find-the-lement – user1802597