时间动画很好玩
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>javascript事件</title>
</head>
<style type="text/css">
.box1{background: #5F8F17;height: 200px;width: 200px; margin-top: 30px;}
</style>
<script type="text/javascript">
function testOnclick(){
alert("good");
};
function testOndblClick(){
alert("你好");
};
function testMouse(){
alert("哈哈");
};
function onkeyUp(){
alert("测试键盘的松开");
}
function onkeyDown(){
alert("测试键盘的按下");
}
function onkeyPress(){
alert("测试键盘的按下,shift和backpace无效")
};
function testOnfocus(x){
x.style.background="red";
};
function testOnBlur(y){
y.style.background="pink";;
};
function testOnload(){
alert("页面加载完成")
}
</script>
<body onLoad="testOnload()" >
<input type="button" value="单击" onClick="testOnclick()">
<input type="button" value="双击" ondblClick="testOndblClick()">
<div class="box1" onmousemove="testMouse()">
</div>
<input type="text" value="测试键盘的松开" onkeyup="onkeyUp()"/><br>
<input type="text" value="测试键盘的按下" onkeydown="onkeyDown()"/><br>
<input type="text" value="测试键盘的按下" onkeypress="onkeyPress()"/><br>
<input type="text" value="测试获取焦点" onfocus="testOnfocus(this)"/><br>
<input type="text" value="测试失去焦点" onblur="testOnBlur(this)"/><br>
</body>
</html>