JavaScript & Dates in Forms

Feature highlight: Displaying Dates
in Forms

Putting in time and date on your site is a cinch.

Key features and JavaScript elements
Use a script or form label and the getTimed() JavaScript routine. Use View | Source on this page to see all the code.

The first example shows how a script can be embedded in a table cell to have the time and/or date displayed in a precise location.

  First Example using embedded script



The second use of the getTimed() function requires more work but gets a flashing DateTimer in a form that can be input - so you know exactly to the minute when the form was filled out and submitted. Note the trick - <body ... onLoad="getTimed('datetimer');">, you must call the getTimed() function with the 'datetimer' parameter right in the <body> declaration. Also, instead of a script you use a form. Again see the code for this page (View |Source) for all the coding details.

  2nd example uses form  


Top of Page  Tutorials Home  JavaScript References  JavaScript Books