Instructions
1. Create a new XHTML document called new_year.html by copying the Source Code
from this DATA FILE. Add the XHTML DTD and any other necessary code and be sure
to validate the HTML before you begin the JS (validators on Resources).
Download the 2 images making sure you keep the image names the same.
2. Copy the .css file from this DATA FILE. You may have to update the name of the
.css file in the XHTML code a bove depending on how you save and title these files.
Be sure to validate the CSS before you begin the JS.
3. For now, set up a global variable called today which contains the current
date information. As you work, use alerts to test the values of your variables to
make sure they are correct. You can comment them out as you move forward.
4. Create a function called showDate(). This function will have one parameter,
today, which stores the date object. The function should extract the day
of the month, the month number and the 4 digit year value. It should return a
text string which combines all of the values into this format: month/day/year .
Use an alert to test.
5. Create another function called showTime(). This function will have
one parameter, today, which stores the date object. The function should
extract the hours, minutes and seconds values from the date object. It should return
a text string which combines all of the values into this format: hour:minute:second
6. Create a third function called ny_clock().This function will write the
date and time in the form boxes on the page. The date should go into the
input box in the source code called dateNow and the time should go into the input box
called timeNow. Use DOM (document object model) scripting to place the
information properly. Call the showDate and showTime functions
using dot notation which follows this pattern:
document.formname.id.value.
Here's an HINT but don't use it unless you need it—see if you can
figure it out on your own.
7. Finally, to see the date and time in action, call the ny_clock function
with a onLoad event handler in the body tag.
Fix any bugs and gloat in your triumph!! ;-)