PDA

View Full Version : Date problem


dvdj
11-10-2002, 04:10 PM
Hi, Is there anyone with the know how to help me develop a script I've been working on.

First off, I'm new to this. I've reached a level where I think I can read and get the jist of Javascript; but writing it is a whole new ballgame.

What I would like to achieve is a script that will look at two arrays one holding peoples birthdates, and the other holding html pages for those dates. I want the script to check the visitors browser date and if it matches one of the dates in the 'birth date' array it will open a new window displaying the relevant html page.

to get the ball rolling I've been testing a script that should check the browsers date see if it matches the date held in stuart=new date and if it does load the page in a new window.

I'm currently getting errors saying that the date is undefined and that stuart is undefined. I cant see why or what I'am doing wrong. Please help.

Please also note that the stuart=new date is set for today the 10th of November 2002, just in case your viewing this at a later date.

Many thanks in advance for any assistance.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>birthdaytestpage</title>
<script language="javascript" type="text/javascript">
<!-- hide script
now = new date
thisYr = now.getYear()
if (thisYr<1900) {
thisYr = thisYr+1900
}

stuart=new date(thisYr,10,10)
if (stuart.getTime() == now.getTime()) {
sa=window.open("sack.htm","stuart","width=100,height=100")
sa.focus()
}
// -->
</script>
</head>

<body onload="stuart()">
its not working
</body>
</html>

Mr J
11-10-2002, 05:04 PM
There is a script on my site that should suit the task at hand.

You can enter any number of dates and URLs etc.

For example go to,

www.huntingground.freeserve.co.uk.scripts/timeload.htm

dvdj
11-10-2002, 05:56 PM
Thank you very much Mr J,

It's going to take me a while to get my head around adapting it but at first glance, your right this is exactly what I am looking for. Many thanks.

I think I'll be spending more time looking through your site, there seems to be alot of useful things there. Thanks again

Mr J
11-11-2002, 07:43 PM
Let me know if you need help adapting

:thumbsup: