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

Example 11.1:
Creating Date Object Instances


Click on the buttons to see the values held by the Date objects we've created. (Note that these examples are slightly different from the examples shown in the book.)



This is the script we used in the HEAD: <SCRIPT LANGUAGE="JAVASCRIPT"> <!-- TodaysDate = new Date() LaunchDate1 = new Date("aug, 15, 1997 12:02:00") LaunchDate2 = new Date("15, Aug, 1997 12:02:00") LaunchDate3 = new Date(1997, 7, 15) LaunchDate4 = new Date(1997, 7, 15, 14, 02, 12) //--> </SCRIPT> Then these buttons in the BODY: <FORM> <INPUT TYPE=BUTTON VALUE="TodaysDate" onclick="alert(TodaysDate)"> <INPUT TYPE=BUTTON VALUE="LaunchDate1" onclick="alert(LaunchDate1)"> <INPUT TYPE=BUTTON VALUE="LaunchDate2" onclick="alert(LaunchDate2)"><P> <INPUT TYPE=BUTTON VALUE="LaunchDate3" onclick="alert(LaunchDate3)"> <INPUT TYPE=BUTTON VALUE="LaunchDate4" onclick="alert(LaunchDate4)"> </FORM>
Previous Chapter's Examples-|-Next Example-|-Return to Chapter Listing