<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>onload onunload onbeforeunload使用
最新推荐文章于 2020-10-06 16:36:49 发布
本文通过一个简单的HTML页面示例,介绍了页面加载过程中涉及的多种JavaScript事件,包括onload、onbeforeunload及onunload等。这些事件对于实现网页交互逻辑至关重要。
262

被折叠的 条评论
为什么被折叠?



