Horje

How to Execute a JavaScript immediately after a page has been loaded - HTML onload Attribute

Body Example.
index.html
Example: HTML
<!DOCTYPE html>
<html>
<head>
<script>
function myFunction() {
  alert("Page is loaded");
}
</script>
</head>

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

</html>

Output should be:

How to Execute a JavaScript immediately after a page has been loaded - HTML onload Attribute




Type:
html
Category:
Web Tutorial
Sub Category:
HTML Attribute
Uploaded by:
Admin