...

View Full Version : Day / Time message.. HELP!!



chill81
01-20-2003, 09:15 AM
Help!

I need to be able to have a message displayed based on the DAY OF THE WEEK AND the CURRENT TIME.

For example:

On Friday from 9pm-10pm, it will say "Test 1"

On Saturday from 9pm-10pm, it will say "Test 2"

I have found several scripts that will display a message based on ONLY the time or ONLY the date. I'm having a hard time finding a script that will do both.

:confused: :confused:

beetle
01-20-2003, 10:42 PM
function showMessage()
{
var d = new Date();
var day = d.getDay(); // Note: Sunday=0, Monday=1, etc...
var hour = d.getHours(); // 24-hour time

switch( true )
{
case ( day == 5 && hour == 9 ) :
{
// Do Friday 9am - 10am stuff here
break;
}
case ( day == 6 && hour == 9 ) :
{
// Do Satruday 9am - 10am stuff here
break;
}
}
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum