More Games - PAINONE

Android games

sites.google.com

일반적인 사용예)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
function AddEvent() {
    var div = document.getElementById("div");
    if(div.addEventListener) {
        div.addEventListener("click", test, false); // IE 외 타 브라우저
    } else {
        div.attachEvent("onclick", test);           // IE
    }
}
     
function test() {
    var a = 1;
    var b = 2;
    alert(a + b);
}
인자 넘기기 예)
1
2
3
4
5
6
7
8
9
10
11
12
function AddEvent(a, b) {
    var div = document.getElementById("div");
    if(div.addEventListener) {
        div.addEventListener("click", function(a, b) { test(a, b); }, false);
    } else {
        div.attachEvent("onclick", function(a, b) { test(a, b); });
    }
}
     
function test(a, b) {
    alert(a + b);
}
 

More Games - PAINONE

Android games

sites.google.com

+ Recent posts