extracting the system date built-in date() object can be manipulated only by creating a new object...
TRANSCRIPT
Extracting the System Date
Built-in Date() object Can be manipulated only by creating a new object instance
var variable = new object var birthDay = Date(“Jul, 13, 1975”)
Returns July 13, 1975 to birthDay var curDate = new Date()
Returns the current system date and time information as an object instance
Extracting the System Date
The variable curDate cannot be manipulated
To extract the date, convert curDate to a string using the toLocaleString() and substring methods
Extracting the System Date
Define a new object for the date in MM/DD/YY HH:MM:SS format
var tNow = new Date()
Extract the date and time and store it in MM/DD/YY HH:MM:SS format
var tlocDate = tNow.toLocaleString()
Extract only the date portion from the tlocDate variable using relative addressing
var tDate = tlocDate.substring(0,10)
Extracting the System Date
Relative addressing
Extracting the Current System Date Using the Date() Object
Click the Notepad button on the taskbar to activate the Notepad window. Click line 19 below the document.bgColor=“blanchedalmond” statement
Type var tNow = new Date() and thenpress the ENTER key. Type
var tlocDate = tNow.toLocaleString()and then press the ENTER key. Type
var tDate = tlocDate.substring(0,10)and then press the ENTER key
Displaying the Current System Date
Use plus signs (+) to concatenate (join) strings and variables
Displaying the Current System Date in the Initial Greeting
Click line 22. Press the SPACEBAR four times. Type document.write(“<H2><CENTER>Welcome, today is “+tDate+”</CENTER></H2>”) and then press the ENTER key
Constructing a Message Using Several Variables
Click line 23. Type var intro1 = “Hi, thanks for visiting our Web site, but we have moved. Please make a note “ and then press the ENTER key
Type var intro2 = “of our new URL (www.funphonics.com) and notify the Webmaster about our new “ and then press the ENTER key
Constructing a MessageUsing Several Variables
Type var intro3 = “location. Click<A Href=‘http://www.scsite.com/’>here</A> or wait 15 seconds “ and then press the ENTER key
Type var intro4 = “to be moved automatically to our new site.” and then press the ENTER key
Constructing a MessageUsing Several Variables
Type var introMsg = intro1+intro2+intro3+intro4 and then press the ENTER key
Writing the Message on the Web Page
Click line 28. Press the SPACEBAR four times. Type document.write(“<H4><FONT Color=‘firebrick’>”+introMsg+”</H4></FONT>”) and then press the ENTER key
Saving a File
Save your file in your folder
Click Save
Testing the Web Page in the Browser
Click the Fun with Phonics button on the taskbar to activate the browser. Click the Refresh button on the browser toolbar