load
load
이벤트는 리소스와 그것에 의존하는 리소스들의 로딩이 완료되면 실행됩니다.
예제
Window
<script>
window.addEventListener("load", function(event) {
console.log("All resources finished loading!");
});
</script>
script
엘리먼트
<script>
var script = document.createElement("script");
script.addEventListener("load", function(event) {
console.log("Script finished loading and executing");
});
script.src = "http://example.com/example.js";
script.async = true;
document.getElementsByTagName("script")[0].parentNode.appendChild(script);
</script>
일반 정보
- 스펙
- DOM L3
- 인터페이스
- UIEvent
- Bubbles
- No
- 취소가능 여부
- No
- 타겟
- Window,Document,Element
- 기본 동작
- None.
속성
속성 | 타입 | 설명 |
---|---|---|
target Read only |
|
The event target (the topmost target in the DOM tree). |
type Read only |
|
The type of event. |
bubbles Read only |
|
Whether the event normally bubbles or not. |
cancelable Read only |
|
Whether the event is cancellable or not. |
view Read only |
|
(window of the document) |
detail Read only |
long (float ) |
0. |
스펙 정보
스펙 | 상태 | 코멘트 |
---|---|---|
UI Events The definition of 'load' in that specification. |
Working Draft | |
HTML Living Standard The definition of 'Load event' in that specification. |
Living Standard |
이것은 문서 로딩이 끝날때 수행되는 단계와 연결되는 섹션과 연결됩니다. 'load' 이벤트는 많은 엘리먼트들에서도 발생합니다. 그리고 스펙 문서에서는 많은 곳에서 "load이벤트를 지연할 수 있는" 것들을 언급한다는 것을 주의하십시오. |