Tag Archives: javascript

Display An Alert Box On Your Web Page

How to display an alert box to users, showing additional information or a simple message.

The alert() statement generates a message box with the message you specify, and an OK button to close the box. The alert box takes the focus away from the current window, and forces the browser to read the message. The user cannot continue viewing your web pages until the box is closed.

The following JavaScript code is to be placed in the body section of your web page, positioned wherever you’d like it to appear:

Displaying Last Modification Date

Display information about the last time your web page was modified.

Displaying the last modified date and time of a web page is important for a web page with changing content.

A small line of JavaScript code will generate the date and time that you last saved your web page. Usually this information appears at the bottom of the web page. JavaScript uses the document.write() method to generate text, and the document.lastModified property to store the date and time when you last saved your web page. The JavaScript code must be enclosed within a starting and ending script tag.

The date and time information that appears is based on Greenwich Mean Time (GMT) and it indicates when you last saved the web page on the web server.

UA-40246369-3