HTML and CSS Reference
In-Depth Information
Case Problem 4
Test your
knowledge of
JavaScript by
creating a splash
screen displaying
famous
birthdays.
Data Files needed for this case problem: functions.js, logo.jpg, modernizr-1.5.js
HappyBirthdayNews.com Linda Chi is the owner of a Web site called
HappyBirthdayNews.com that specializes in birthday gifts and memorabilia. To make her
site more interesting for users, Linda wants to create an opening screen that displays the
current date and a famous birthday occurring on that date. She has asked for your help
in writing the JavaScript code to generate the welcome message. She has designed the
page's style and content, and has also located the following JavaScript functions:
• The showDate() function returns the current date as the text string
Weekday,ƒMonthƒDay,ƒYear , where Weekday is the day of the week, Month is
the name of the month, Day is the day of the month, and Year is the four-digit year
value. The showDate() function has no parameters.
• The dayNumber() function returns the day number of the current date, ranging from
1 (the first day of the year) to 366 (the last day of the year). The dayNumber() func-
tion has no parameters.
• The showBirthDay() function returns a text string describing a famous birthday on
the given date. The function has a single parameter— day , which is equal to the day
number of the famous birthday you want to view.
The three functions have already been saved for you in a file named functions.js .
Figure 10-40 shows one possible solution to this problem.
Figure 10-40
Happy birthday page
Complete the following:
1. Use your text editor to create the file birthday.htm and save it in the tutorial.10\
case4 folder included with your Data Files. Create a comment section containing
your name and the date as well as a brief description of the Web page.
2. Design the birthday.htm page as the opening page of the HappyBirthdayNews.com
Web site. The content and design of the site are up to you. You can use the logo.jpg
graphic file as the logo for the Web site and supplement it with any other content or
graphics you find.
 
Search WWH ::




Custom Search