Click to See Complete Forum and Search --> : Re-directing users depending on the time of day


roona
12-03-2002, 11:32 AM
Can any one help me? I'm tryin to locate a script I saw a while ago which allows you to re-direct a user accordin to the time of day (not exact times, just vague mornin, afternoon and night.

If someone could help me with this i'd really appreciate it.

Cheers.

;)

gil davis
12-03-2002, 11:49 AM
<script>
var now = new Date();
var time = now.getHours(); // returns 0-23
if (time >= 5 && time < 12) // 5 am to 12 pm
{location.href="morning.htm"}
if (time >=12 && time < 18) // 12 pm to 6 pm
{location.href="afternoon.htm"}
if (time >=18 || time < 5) // 6 pm to 5 am
{location.href="night.htm"}
</script>

roona
12-04-2002, 03:19 AM
Excellent, thank you Gil x

Eric Strain
12-04-2002, 03:34 AM
Hi All:
I'm new to this list and almost just as new to JavaScript. does anyone know how I determine what the required query string is for a search engine? I connect to the internet through dialup networking, I want to use the run menu to navigate through the internet. for example if I want to use yahoo to search for "classic cars" I want to connect to the internet, then use the run menu and navigate directly to the results page. for example if I type
http://www.yahoo.com/search/p=classic + cars
I want to go directly to the results page for that search instead of filtering through the other information. how do I determine what the correct query string for the target search engine is? Thanks in advance for any help.

gil davis
12-04-2002, 05:32 AM
I would expect that each "engine" would have it's own criterion. A search of the "engine's" web site HELP might give you the answer. Or a dump of their search page. There may be hidden form fields that contain necessary information, and then there is the possibility of cookies adding to the recipe.