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>
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>