How to call javascript function after page load?

Example 1:-

File name : index.php

<!DOCTYPE html>
<html>

<head>
<title>Call JavaScript Function After Page Load Complete </title>
</head>

<body onload="afterPageLoad()">

<h1>Welcome to ittutorial.in</h1>

<p>call javascript function before page load complete</p>
</body>

<script language='javascript'>
function afterPageLoad(){
alert('Hello World');
}
</script>

</html>

Example 2:

File name : index.php

<!DOCTYPE html>
<html>

<head>
<title>Call JavaScript Function After Page Load Complete </title>
</head>

<body>

<h1>Welcome to ittutorial.in</h1>

<p>call javascript function before page load complete</p>
</body>

<script language='javascript'>
function afterPageLoad(){
alert('Hello World');
}

window.onload = function afterPageLoad();

</script>


</html>





Previous Next


Trending Tutorials




Review & Rating

0.0 / 5

0 Review

5
(0)

4
(0)

3
(0)

2
(0)

1
(0)

Write Review Here