'도쿠망스게테레멘트베이드 (& # 39, 확실히 있는 div id exists& # 39;)' 되돌려줍니다 nulll.
난 내가 마지막으로 javascript 를 위해 당초 로드되었는지 smartupdate wouldn& # 39, t need to 걱정 onload 이벤트. 난 또 이벤트 onload 사용하여 했다. # 39, it& 아주 짜증. 아무 생각 없어 또는 크게 도움이 될 것이라고 평가했다.
또한 방법 페이지에서 js 실행하십시오 주의해야 합니다. 예를 들어 이 같은 일이 할 수 있습니다.
(function(window, document, undefined){
var foo = document.getElementById("foo");
console.log(foo);
})(window, document, undefined);
전에 전화 할 수 있기 때문에 이 반환되므로 nulll you&; d # 39 는 문서에만 로드되었는지.
더 나은 선택입니다.
(function(window, document, undefined){
// code that should be taken care of right away
window.onload = init;
function init(){
// the code to be called when the dom has loaded
// #document has its nodes
}
})(window, document, undefined);
여러 이유가 있을 수 있습니다. '' doesn& 도쿠망스게테레멘트베이드 # 39 빗나갔다.
잘못된 ID 합니다. >. ID 와 NAME 토큰 문자로 시작해야 합니다 ([z 는 za]), 숫자 글자 수를 차례로 입력할 수 있으며 ([0-9]), 하이픈 (- " ";), 밑줄 (" _";), 콜론 (:" ";), 및 기간 (." ";). (출처: https://stackoverflow.com/questions/70579/what-are-valid-values-for-the-id-attribute-in-html)
일부 id, 이름, '로 사용할 수 있는' < 이미 사용한 meta> in your 헤더입니다 (예를 들어, 저작권, 작가이다. 하지만 괜찮아 보이는 이상한 상태입니까 me:) & # 39 쪽의 경우 IE 사용 살펴보겠습니다. (출처: http://www.phpied.com/getelementbyid-description-in-ie/)
(출처: # 8710249 https://stackoverflow.com/questions/8710100/calling-a-specific-id-inside-a-frame/8710249)
내가 두 번 이상 사용한 것에 대한 동일한 ID: 이 경우 최소 1 요소점 복귀하십시오 도쿠망스게테레멘트베이드 한다 ''