HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

Body onload Event

Body Object Reference Body Object

Definition and Usage

The onload event occurs immediately after a page is loaded.

Syntax

onload="JavaScriptCode"

Parameter Description
JavaScriptCode Required. Specifies a JavaScript to be executed when the event occurs


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The onload event is supported in all major browsers.


Example

Example

Alert "Page is loaded" immediately after a page is loaded:

<html>
<head>
<script>
function load()
{
alert("Page is loaded");
}
</script>
</head>

<body onload="load()">
<h1>Hello World!</h1>
</body>
</html>

Try it yourself »


Body Object Reference Body Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE