• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Hour 2. Creating a Simple Script > Adding the Script to a Web Page

Adding the Script to a Web Page

You should now have a complete script that calculates a result and displays it. Your listing should match Listing 2.2. In case you're still a bit confused, Listing 2.3 is a line-by-line breakdown of the script with an explanation for each statement.

Listing 2.2 The Complete Date and Time Script

1: <script language="JavaScript">
2: now = new Date();
3: localtime = now.toString();
4: utctime = now.toGMTString();
5: document.write("<b>Local time:</b> " + localtime + "<BR>");
6: document.write("<b>UTC time:</b> " + utctime + "</p>");
7: </script>


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint