関数リテラルとaddEventLstenerと

はまったこと。メモ。

OK

addEventListener("load",abc,false);
function abc(){
	window.alert("abc");
}

NG

addEventListener("load",abc,false);
var abc = function(){
	window.alert("abc");
}

OK

var abc = function(){
	window.alert("abc");
}
addEventListener("load",abc,false);

Post a Comment

Your email is never published nor shared.