laitueceleste
08-28-2002, 08:38 PM
I have a simple script that updates a link based on the month. The selection criteria looks at the month and year and picks a link out of the array and then prints it at the end of the script.
The problem is that I'm getting different results in Netscape and MS-IE. The value for i isn't passed in Netscape, but it is in MS-IE. I get different results in different browsers.
Here's the jist of the code:
var newDate = new Date()
var month = newDate.getMonth()
var year = newDate.getYear()
var txt = "Group Calendar"
var i = 3
var url = new Array
url[0] = "groupcal_aug2002.htm"
url[1] = "groupcal_sep2002.htm"
url[2] = "groupcal_oct2002.htm"
url[3] = "groupcal_nov2002.htm"
url[4] = "groupcal_dec2002.htm"
// August 2002
if ((month == 7) && (year == 2002))
{
var i = 0
}
// September 2002
if ((month == 8) && (year == 2002))
{
var i = 1
}
// October 2002
if ((month == 9) && (year == 2002))
{
var i = 2
}
// November 2002
if ((month == 10) && (year == 2002))
{
var i = 3
}
// December 2002
if ((month == 11) && (year == 2002))
{
var i = 4
}
// prints link to current calendar page
document.write('<a href=\"' + url[i] + '\" target=\"_top\">');
document.write(txt + '</a>');
It works fine in MS-IE. The link for August is the outcome. The value for i is passed to the end of the script. However, this doens't work in MS-IE. It gives me the link for November. So this means the value for i isn't being passed.
What is the problem? I have been investigating, but I don't know what the culprit could be.
The problem is that I'm getting different results in Netscape and MS-IE. The value for i isn't passed in Netscape, but it is in MS-IE. I get different results in different browsers.
Here's the jist of the code:
var newDate = new Date()
var month = newDate.getMonth()
var year = newDate.getYear()
var txt = "Group Calendar"
var i = 3
var url = new Array
url[0] = "groupcal_aug2002.htm"
url[1] = "groupcal_sep2002.htm"
url[2] = "groupcal_oct2002.htm"
url[3] = "groupcal_nov2002.htm"
url[4] = "groupcal_dec2002.htm"
// August 2002
if ((month == 7) && (year == 2002))
{
var i = 0
}
// September 2002
if ((month == 8) && (year == 2002))
{
var i = 1
}
// October 2002
if ((month == 9) && (year == 2002))
{
var i = 2
}
// November 2002
if ((month == 10) && (year == 2002))
{
var i = 3
}
// December 2002
if ((month == 11) && (year == 2002))
{
var i = 4
}
// prints link to current calendar page
document.write('<a href=\"' + url[i] + '\" target=\"_top\">');
document.write(txt + '</a>');
It works fine in MS-IE. The link for August is the outcome. The value for i is passed to the end of the script. However, this doens't work in MS-IE. It gives me the link for November. So this means the value for i isn't being passed.
What is the problem? I have been investigating, but I don't know what the culprit could be.