日期:2014-05-16 浏览次数:20490 次
<!DOCTYPE HTML>
<html>
<head>
<meta charset="gb2312" />
<title></title>
<style>
</style>
</head>
<body>
<div id="a">click me</div>
<div id="b">
</div>
<script>
function $(el){
return typeof el == 'string' ? document.getElementById(el) : el;
}
var a = $('a'),
b = $('b');
a.onmousedown = function(){
b.innerHTML = 'onmousedown';
}
a.onmouseup = function(){
b.innerHTML += ' onmouseup';
}
a.onclick = function(){
b.innerHTML += ' onclick';
}
</script>
</body>
</html>