<script> </script> - attributes: language
This tag is used to separate the JavaScript code from the remainder of the HTML code. The language attribute should have the value of "JavaScript". Also in case the browser viewing the page does not recognize the JavaScript code, all of the code should be enclosed in an HTML comment. The following example shows this done.
<script language="JavaScript">
<!-- This is the HTML Comment that hides the JavaScript code from old browsers
The JavaScript code can add dynamic information to a web page that static HTML code cannot. The use of the JavaScript statement document.write() is very useful for this.
The document object in JavaScript allows a number of useful methods and properties. Check out chapter 16 in the text for a discussion of more items than covered here. We will
The document.write() method allows text information (strings) to be added to the the HTML code. The parameter of the method (the stuff placed between the parentheses) can be a single string or a multiple strings separated by commas. Whatever is written will then be interpreted by the web browser as HTML code, so you can include HTML tags to help format the information being written.
The document.URL property gives the URL of the current page.
The document.lastModified property gives the date and time that the web page was last modified. Note this property gives the information as a Date object. See chapter 28 of the text for addition information about the Date object.
The Date object allows JavaScript code to retrieve specific information about the dat stored in the Date object.
This will create a new Date object with the current date and time.
The above methods will return the specified data when used with a Date object that alread has a date stored in it.