Previous Example-|-Next Example-|-Return to Chapter Listing

Example 7.17:
Creating a Function Object

[This example works with Netscape Navigator 3. It will not work with Internet Explorer 3.]

We created a new function object called FuncObj(). Calling that function carries out the script assigned to the function; in tihs example it simply displays another page.

Click the button to execute the function object:


In the HEAD we have this script: <SCRIPT LANGUAGE="JAVASCRIPT"> <!-- var FuncObj = new Function("location='7-17b.htm';") //--> </SCRIPT> In the BODY of the page we have this button: <FORM> <INPUT TYPE="button" VALUE="Run function" onClick="FuncObj()"> </FORM>
Previous Example-|-Next Example-|-Return to Chapter Listing