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 message | Timing range | Voice file |
---|---|---|
Good Morning | From 6 am To 12 am | gm.wav |
Good Afternoon | From 0 pm To 5 pm | ga.wav |
Good Evening | From 5 pm To 12 pm | ge.wav |
Please Go To Bed | From 0 am To 6 am | gb.wav |
If someone visits this page at, say, eight o’clock in the morning, the page will display the message ...
Get Practical Web Technologies now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.