HTML and CSS Reference
In-Depth Information
Sean has created the layout of the page, and she needs you to write the scripts to insert
the current date and the calendar of events for the current day. To assist you, she has
located two functions:
• The showDate() function returns a text string containing the current date in the for-
mat
Weekday,ƒMonthƒDay,ƒYear
. The function has no parameter values.
• The weekDay() function returns a text string containing the name of the current
weekday, from Sunday through Saturday. This function also has no parameter values.
The two functions are stored in an external JavaScript file named
functions.js
. The daily
schedules have been stored in files named
sunday.htm
through
saturday.htm
.
Complete the following:
1. Use your text editor to open the
todaytxt.htm
file from the tutorial.10\case3 folder
included with your Data Files. Enter
your name
and
the date
in the comment section
of the file and save it as
today.htm
.
2. In the head section just above the closing
</head>
tag, insert a
script
element
accessing the
functions.js
ile.
3. Scroll down the file and locate the
div
element with the id
dateBox
. Within this ele-
ment insert a
script
element. The script should run the following two commands:
a. Write the following HTML code to the Web page:
Todayƒisƒ<brƒ/>
b. Write the text string returned by the showDate() function to the Web document.
4. Scroll down the file and locate the
h1
heading with the text
Today at the Union
.
Within the empty paragraph that follows this heading, insert another
script
ele-
ment. Within the script element, do the following:
a. Insert the following multiline comment:
Displayƒtheƒdailyƒscheduleƒinƒanƒinlineƒframe.
Dailyƒschedulesƒareƒstoredƒinƒtheƒfilesƒsunday.
htmƒthroughƒsaturday.htm.
b. Insert a command to write the HTML code
<iframeƒsrc='
weekday
.htm'></iframe>
to the Web page, where
weekday
is the text string returned by the weekDay()
function.
5. Save your changes to the document.
6. Open
today.htm
in your Web browser. Verify that it shows the current date and that
the daily schedule matches the current weekday.
7. If you have the ability to change your computer's date and time, change the date to
different days of the week and reload (not simply refresh) the Web page. Verify that
the date and the daily schedule change to match the new date you selected. Debug
your code as necessary.
8. Submit your completed files to your instructor.