Archive for the ‘vijay’ Tag

How does the Javascript onload event work ?

onload is javascript event.

Purpose : To call any action while the page is rendered.

Still lot of people are not aware about when the onload funtion is called.

Lot of  people  thing  as onload can be specified in the <body> tag as soon as the body tag is rendered in the html , the on load will called for  its action.

But that is not the case onload will only be called at last when the whole page is rendered.

Copy past the below HTML  and test it baby. 

<html>
<head>
 <script>
  function ping() {alert(“Hellow world!!!”)}
 </script>
</head>
<body onload=”ping()”><h1>Bookstore</h1><ul>
 <script>
  alert(“alert inside the body”)
 </script>
something
</body>
</html>

If you feel this little information was useful please leave some comment.