O'Reilly logo

Practical Web Technologies by V. Lau, P. K. Yuen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

12.2. Static date and time on the Web

12.2.1. A page can say good morning

One simple use of time detection is to develop a Web page that can greet visitors with some voice messages depending on the time. A few seconds of voice messages such as “Good Morning” can give a warm welcome to your visitors and customers. Our next example shows how to divide the time into four sections with time-dependent text and voice messages. The structure of the page is listed below:

Display messageTiming rangeVoice file
Good MorningFrom 6 am To 12 amgm.wav
Good AfternoonFrom 0 pm To 5 pmga.wav
Good EveningFrom 5 pm To 12 pmge.wav
Please Go To BedFrom 0 am To 6 amgb.wav

If someone visits this page at, say, eight o’clock in the morning, the page will display the message ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required