// DOM Leve l 이벤트 할당
// onload
window.onload = function (e) {
console.log(e);
};
// DOM Level 1 이벤트 방식은 각 이벤트 타입 당 한개의 핸들러만 할당 가능하다. 즉, 아래 이벤트는 발생되지 않는다.
window.onload = function (e) {
console.log(e);
};
// DOM Level 2 이벤트 할당
// DOM Level 2 이벤트 방식은 각 이벤트 타입 당 여러개의 핸들러가 할당 가능하다. 즉, 아래 추가된 이벤트는 모두 발생된다.
// IE
window.attachEvent && window.attachEvent('onload', function (e) {
console.log(e);
});
window.attachEvent && window.attachEvent('onload', function (e) {
console.log(e);
});
// 표준 브라우저
window.addEventListener && window.addEventListener('load', function (e) {
console.log(e);
}, false);
window.addEventListener && window.addEventListener('load', function (e) {
console.log(e);
}, false);
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.