Skip to content

Instantly share code, notes, and snippets.

@lyuehh
Created October 18, 2012 06:44
Show Gist options
  • Save lyuehh/3910206 to your computer and use it in GitHub Desktop.
Save lyuehh/3910206 to your computer and use it in GitHub Desktop.
click a input in ie
<!--demo from : http://www.cnblogs.com/rubylouvre/archive/2012/10/18/2729388.html -->
<!DOCTYPE HTML>
<html>
<head>
<title>onbeforeactivate by 司徒正美</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script>
window.onload = function(){
function callback(e) {
console.log(e.type)
}
var a = document.getElementById("test")
a.attachEvent('onbeforeactivate', callback);
a.attachEvent('onactivate', callback);
a.attachEvent('onfocusin', callback);
a.attachEvent('onfocus', callback);
a.attachEvent('onmousedown', callback);
a.attachEvent('onmouseup', callback);
a.attachEvent('onclick', callback);
}
</script>
</head>
<body>
<input id="test" value="点我"/>
</body>
</html>
<!--
日志: mousedown
日志: beforeactivate
日志: activate
日志: focusin
日志: focus
日志: mouseup
日志: click
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment