Created
August 8, 2010 12:28
-
-
Save higeorange/513972 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |
<html lang="ja"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> | |
<title>form tezst</title> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
var nanka = { | |
addEvent:function(node,type,fn,useCapture){ | |
if (document.addEventListener) { | |
node.addEventListener(type, fn, useCapture); | |
} else if (document.attachEvent) { | |
node.attachEvent('on'+type, function(){ | |
fn.call(node,window.event) | |
}); | |
} else { | |
var _type = 'on' + type; | |
if (typeof node[_type] === 'function') { | |
var _fn = node[_type], __fn = fn; | |
fn = function(evt){ | |
if (evt) evt = window.event; | |
_fn.call(this, evt); | |
__fn.call(this, evt); | |
}; | |
} | |
node[_type] = fn; | |
} | |
}//addEvent | |
};//nanka | |
nanka.addEvent(document,"DOMContentLoaded",function(){ | |
nanka.addEvent(document.getElementById("nnn"),"focus",function (){alert("hello")}) | |
}) | |
</script> | |
<input type="text" id="nnn" /> | |
<input type="submit" /> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment