December 2013
Intermediate to advanced
384 pages
9h 54m
English
<script> function onloadHandler(){ (initialization code here...) } </script> ... <body onload="onloadHandler()>
To add initialization code that runs when the pages are loaded in JavaScript, create a function in JavaScript that performs the initialization. For example, the following JavaScript code shows a simple skeleton initialization function:
function onloadHandler(){ (initialization code here...) }
To cause the onloadHandler() to trigger when the page is fully loaded, add the event hander function to the onload attribute of the <body> element in the HTML. For example:
<body onload="onloadHandler()> ...
Read now
Unlock full access