Download presentation
Presentation is loading. Please wait.
Published byErika Stafford Modified over 9 years ago
1
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
2
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
4
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)
5
Extracting the System Date Relative addressing
6
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
7
Type var tNow = new Date() and then press 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
9
Displaying the Current System Date Use plus signs (+) to concatenate (join) strings and variables
10
Displaying the Current System Date in the Initial Greeting Click line 22. Press the SPACEBAR four times. Type document.write(“ Welcome, today is “+tDate+” ”) and then press the ENTER key
12
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
13
Constructing a Message Using Several Variables Type var intro3 = “location. Click here 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
14
Constructing a Message Using Several Variables Type var introMsg = intro1+intro2+intro3+intro4 and then press the ENTER key
16
Writing the Message on the Web Page Click line 28. Press the SPACEBAR four times. Type document.write(“ ”+introMsg+ ” ”) and then press the ENTER key
18
Saving a File Save your file in your folder
19
Click Save
20
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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.