天天看點

onload onunload onbeforeunload使用

<html>
<head>
	<script>
		function test1(){
			//window.alert("Ok onload");	
			var t = document.getElementById('text1');
			t.onfocus;
		}
		function test2(){
			window.alert("Ok");	
		}
		
	</script>	
</head>	
	<body onload = "test1()" onbeforeunload = "test2()" onunload = "test2()">
	<input id = "text1" type ="text" onfocus = "test1()"/>
	</body>
</html>
           

繼續閱讀