Time Popup

By Weasel on Oct 02, 2009

Weasel's first javascript! on your website it pops up an alert with a response depending on the time!
put it where you'd put html/javascript!

Image

<html>
<body>
<script type="text/javascript">
//Twango's Differant Time reaction script
var d = new Date();
var time = d.getHours();
if (time >= 1 && time <= 7)
{
alert("Yawn... It's too early...");
}
if (time >= 8 && time <= 10)
{
alert("Breakfast Time!");
}
if (time == 11)
{
alert("Time to walk the dog");
}
if (time >= 12 && time <= 14)
{
alert("Lunch Time!");
}
if (time >= 15 && time <= 16)
{
alert("Time to Watch TV");
}
if (time >= 17 && time <= 18)
{
alert("Dinner Time");
}
if (time >= 19 && time <= 21)
{
alert("Time to get ready for bed");
}
if (time >= 22 && time <= 24)
{
alert("Yawn... It's late");
}
</script>
</body>
</html>

Comments

Sign in to comment.
Korvin   -  Mar 02, 2010
var d = new Date();
var time = d.getHours();
if (time == 11)
    alert("Time to walk the dog!");
else if (time >= 22)
    alert("Yawn... It's late");
else if (time >= 19)
    alert("Time to get ready for bed");
else if (time >= 17)
    alert("Dinner Time");
else if (time >= 15)
    alert("TV Time!");
else if (time >= 12)
    alert("Lunch Time!");
else if (time >= 8)
    alert("Breakfast Time!");
else if (time >= 1)
    alert("Yawn... It's too early...");

best way I could shorten it =p

 Respond  
Weasel   -  Dec 27, 2009

Yeah... i'm working on some MMORPG 'Hacking'... in perl...

 Respond  
Tea   -  Dec 20, 2009

Lol, something in the Perl section wouldn't go a miss.

 Respond  
Weasel   -  Nov 14, 2009

Lol thanks, i NEED requests!!! here are some languages i can do and how fluent i am in them (1-10)
JavaScript(9)
HTML(10)
CSS(8)
DHTML(9)
Perl(4)

 Respond  
Joshuaxiong1   -  Nov 13, 2009

nice! love it!

 Respond  
Cracker200   -  Oct 03, 2009

Lol Nice work ;D

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.