HTML onload event properties
Examples
When you run JavaScript after the document has finished loading the script:
<body onload="load()">
try it"
Browser Support
All major browsers support onload event attributes.
Definition and Usage
onload attribute triggered after the document object has finished loading.
onload commonly used in <body> element, used to specify the script (including images, script, css files, etc.) is executed after the page is fully loaded.
Differences between HTML 4.01 and HTML5
None.
grammar
<elementonload=" script ">
Property Value
值 | 描述 |
---|---|
script | 规定该onload事件触发时执行的脚本。 |
HTML Event Attributes