How to work with the Java Script
To work with the Java Script
This Java Script code sample shows you how to use the simple Java Script to display the time and date obtained from the viewer’s operating system.
JavaScript sample:
-
The document.write() method on the "Your Local Time" line writes an H1-formatted text string from the document to the screen of the browser.
-
new Date() creates a new date object containing the long version of the current date from the viewer’s operating system. This object is assigned to currtime.
The last line is output again to the browser’s screen using the document.write() method, with the embedded currtime variable set to the current time and date.
document.write("Your Local Time"),
currtime = new Date();
document.write("It is currently " + currtime + " where you live.")
The result is shown as below.
No comments:
Post a Comment