Have a look at the following code from which you can learn the execution path of the scripts in a web page.
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
//This example shows the which programming statements or function calls exectues in a one by one fashion
alert('Standalone alert statement; the first statement in the script tag');
function callMe()
{
alert('Inside the callMe function');
}
//onload event assignment.
window.onload = function () {
alert('inside the onload event');
}
//Invoking the callMe function
callMe();
</script>
</head>
<body>
</body>
</html>
Please let me know if you have any problem with the above code.
Bookmarks