Facebook Like Button

JavaScript

I am thinking of practicing JavaScript, so lets get started...
If the time is less than 10, you will get a "Before 10am" greeting. Otherwise you will get a "After 10am" greeting.
You need to enclose this script inside script tag.
You need to visit this page at different times to confirm that my script is working well or you can change time of your System.

JavaScript:
var d = new Date();
var time = d.getHours();
if (time < 10) { document.write("Before 10am"); } else { document.write("After 10am"); }

OUTPUT:

No comments: