W3Schools 在线编辑工具(TIY) V3.0
编辑的代码:
运行代码 »
©
w3s.com.cn
运行结果窗口大小:
300 x 150
<
!DOCTYPE
html
>
<
html
>
<
head
>
<
script
>
function
mymessage()
{
alert(
"这段消息由 onload 事件触发"
);
}
<
/script
>
<
/head
>
<
body
onload
="mymessage()"
>
<
/body
>
<
/html
>
<!DOCTYPE html> <html> <head> <script> function mymessage() { alert("这段消息由 onload 事件触发"); } </script> </head> <body onload="mymessage()"> </body> </html>