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

Example 4.3:
Undefined Variables


Click on the button to see what happens when you use text2, an undefined variable. Netscape Navigator displays a message saying that the variable is undefined (it's really uninitialized). Internet Explorer simply displays a blank message box.



This is the script we used. First, we put this in the HEAD: <SCRIPT LANGUAGE="JAVASCRIPT"> <!-- var text2 //--> </SCRIPT> Then we created this button: <form> <input type="button" value="Undefined variable, text2" onclick=alert(text2)> </form>
Previous Example-|-Next Example-|-Return to Chapter Listing