Previous Chapter's Examples-|-Next Example-|-Return to Chapter Listing

Example 7.1:
Defining Functions


You saw an Alert box created by function1(). The function named function1() is called as soon as the HEAD section has been loaded. As you can see from the script below, this displays an Alert box. Notice, however, that the function call appears before the function definition--it appears that we have used the function before we created it.

This is the script we used: <SCRIPT LANGUAGE="JavaScript"> <!-- function1() function function1() { alert("This is function1 running.") } //--> </SCRIPT> </HEAD> <BODY> <BR>
Previous Chapter's Examples-|-Next Example-|-Return to Chapter Listing