script works in IE but not Netscape!
Hi,
I'm a newbie to script and have modified script that I found to manage double combos. Problem is it works in IE but not in Netscape. Ive used the javascript console and it gives me an error 'group[x] has no properties' on the line
for (i=0;i<group[x].length;i++){
I've pasted the code below. Id be really gratefull if someone could tell me why I'm getting this error.
Ron
<HTML><BODY bgColor=#ffffff topMargin=0>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<TITLE>Scottish Schools Athletic Association entry form</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="Microsoft FrontPage 4.0" name=GENERATOR>
<form action="http://" method="POST" name="entry_details" id="entry_details">
<FONT color="#003399" size=3 face="tahoma, helvetica"><B> <FONT color=#003399
size=5 face="Arial, Helvetica, sans-serif"><br>
</FONT> </b></font><font face="tahoma, helvetica" size=2><b>
<select name="g_age" id="select2" onChange="populate_it(g_age.options.value)">
<option value="0" selected>Available Groups</option>
<option value="1" >Girls under 16</option>
<option value="2">Girls over 16</option>
<option value="3">Boys under 16</option>
<option value="4">Boys over 16</option>
</select>
</b></font>
<p><FONT color="#003399" size=3 face="tahoma, helvetica"><B> <FONT color=#003399 size="4" face="Arial, Helvetica, sans-serif">Event</FONT><FONT color=#003399
size=4>
<select name="event1" id="event1">
<option value="1">Events available</option>
</select>
</FONT><font color="#003399" size=4 face="tahoma, helvetica"><br>
</font><FONT color=#003399 size="4" face="Arial, Helvetica, sans-serif">Event</FONT><FONT color=#003399
size=4>
<select name="event2" id="event2">
<option value="1">Events available</option>
</select>
</FONT> <br>
<FONT color=#003399 size="4" face="Arial, Helvetica, sans-serif">Event</FONT><FONT color=#003399
size=4>
<select name="event3" id="event3">
<option value="1">Events available</option>
</select>
</FONT> <br>
<FONT color=#003399 size="4" face="Arial, Helvetica, sans-serif">Event</FONT><FONT color=#003399
size=4>
<select name="event4" id="event4">
<option value="1">Events available</option>
</select>
</FONT><FONT color="#003399" size=4 face="tahoma, helvetica"><br>
</FONT><FONT color=#003399 size="4" face="Arial, Helvetica, sans-serif">Event</FONT><FONT color=#003399
size=4>
<select name="event5" id="event5">
<option value="1">Events available</option>
</select>
</FONT> <br>
<FONT color=#003399 size="4" face="Arial, Helvetica, sans-serif">Event</FONT><FONT color=#003399
size=4>
<select name="event6" id="event6">
<option value="1">Events available</option>
</select>
</FONT></b></font></p>
<FONT color=#003399 size="3" face="tahoma, helvetica"><B> </B></font>
<p><FONT color="#003399" size=3 face="tahoma, helvetica"><B>
<script>
<!--
/*
Double Combo Script Credit
By Website Abstraction (www.wsabstract.com)
Over 200+ free JavaScripts here!
*/
var groups=document.entry_details.g_age.options.length
var group=new Array(groups)
for (i=0; i<groups; i++)
group[i]=new Array()
group[1][0]=new Option("Events Available","0")
group[1][1]=new Option("60m","1")
group[1][2]=new Option("60m Hurdles","2")
group[1][3]=new Option("200m","3")
group[1][4]=new Option("400m","4")
group[1][5]=new Option("800m","5")
group[1][6]=new Option("1500m","6")
group[1][7]=new Option("Shot Putt","7")
group[1][8]=new Option("High Jump","8")
group[1][9]=new Option("Long Jump","9")
group[2][0]=new Option("Events Available","0")
group[2][1]=new Option("60m","1")
group[2][2]=new Option("60m Hurdles","2")
group[2][3]=new Option("200m","3")
group[2][4]=new Option("400m","4")
group[2][5]=new Option("800m","5")
group[2][6]=new Option("1500m","6")
group[2][7]=new Option("Shot Putt","7")
group[2][8]=new Option("High Jump","8")
group[2][9]=new Option("Long Jump","9")
group[2][10]=new Option("Pole Vault","10")
group[3][0]=new Option("Events Available","0")
group[3][1]=new Option("60m","1")
group[3][2]=new Option("60m Hurdles","2")
group[3][3]=new Option("200m","3")
group[3][4]=new Option("400m","4")
group[3][5]=new Option("800m","5")
group[3][6]=new Option("1500m","6")
group[3][7]=new Option("Shot Putt","7")
group[3][8]=new Option("High Jump","8")
group[3][9]=new Option("Long Jump","9")
group[4][0]=new Option("Events Available","0")
group[4][1]=new Option("60m","1")
group[4][2]=new Option("60m Hurdles","2")
group[4][3]=new Option("200m","3")
group[4][4]=new Option("400m","4")
group[4][5]=new Option("800m","5")
group[4][6]=new Option("1500m","6")
group[4][7]=new Option("Shot Putt","7")
group[4][8]=new Option("High Jump","8")
group[4][9]=new Option("Long Jump","9")
group[4][10]=new Option("Pole Vault","10")
var temp1=document.entry_details.event1
var temp2=document.entry_details.event2
var temp3=document.entry_details.event3
var temp4=document.entry_details.event4
var temp5=document.entry_details.event5
var temp6=document.entry_details.event6
function populate_it(x){
for (m=temp1.options.length-1;m>0;m--)
temp1.options[m]=null
for (m=temp2.options.length-1;m>0;m--)
temp2.options[m]=null
for (m=temp3.options.length-1;m>0;m--)
temp3.options[m]=null
for (m=temp4.options.length-1;m>0;m--)
temp4.options[m]=null
for (m=temp5.options.length-1;m>0;m--)
temp5.options[m]=null
for (m=temp6.options.length-1;m>0;m--)
temp6.options[m]=null
for (i=0;i<group[x].length;i++){
temp1.options[i]=new Option(group[x][i].text,group[x][i].value)
temp2.options[i]=new Option(group[x][i].text,group[x][i].value)
temp3.options[i]=new Option(group[x][i].text,group[x][i].value)
temp4.options[i]=new Option(group[x][i].text,group[x][i].value)
temp5.options[i]=new Option(group[x][i].text,group[x][i].value)
temp6.options[i]=new Option(group[x][i].text,group[x][i].value)
}
temp1.options[0].selected=true
temp2.options[0].selected=true
temp3.options[0].selected=true
temp4.options[0].selected=true
temp5.options[0].selected=true
temp6.options[0].selected=true
}
</script>
</b></font></p>
</form>
<FONT color="#003399" size=3 face="tahoma, helvetica"><B>
<P align=center> </P>
<P> </P>
</b></font></BODY></HTML>
<body>
</body>
</html>
[7768 byte] By [
Ron_Hunter] at [2007-11-19 2:29:37]

# 1 Re: script works in IE but not Netscape!
Your text order needs a little sorting out. Netscape is a little more finicky about this than IE so it may well might be causing the problem. I've rearranged things a bit (comments in blue) . Take a look, I haven't tested it so let me know whether this solves the problem.
Regards
__________________
Remote Control Cars at RC-Playtime.co.uk (http://www.rc-playtime.co.uk/)
__________________
<HTML>
<!-- You need the head tags -->
<HEAD>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<TITLE>Scottish Schools Athletic Association entry form</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="Microsoft FrontPage 4.0" name=GENERATOR>
<!-- Tell the browser what language you are using -->
<script language="JavaScript">
<!--
/*
Double Combo Script Credit
By Website Abstraction (www.wsabstract.com (http://www.wsabstract.com/))
Over 200+ free JavaScripts here!
*/
<!-- these statements are not contained within a function so they -->
<!-- will be executed as the page loads, initialising the variables -->
var groups=document.entry_details.g_age.options.length
var group=new Array(groups)
for (i=0; i<groups; i++)
group=new Array()
group[1][0]=new Option("Events Available","0")
group[1][1]=new Option("60m","1")
group[1][2]=new Option("60m Hurdles","2")
group[1][3]=new Option("200m","3")
group[1][4]=new Option("400m","4")
group[1][5]=new Option("800m","5")
group[1][6]=new Option("1500m","6")
group[1][7]=new Option("Shot Putt","7")
group[1][8]=new Option("High Jump","8")
group[1][9]=new Option("Long Jump","9")
group[2][0]=new Option("Events Available","0")
group[2][1]=new Option("60m","1")
group[2][2]=new Option("60m Hurdles","2")
group[2][3]=new Option("200m","3")
group[2][4]=new Option("400m","4")
group[2][5]=new Option("800m","5")
group[2][6]=new Option("1500m","6")
group[2][7]=new Option("Shot Putt","7")
group[2][8]=new Option("High Jump","8")
group[2][9]=new Option("Long Jump","9")
group[2][10]=new Option("Pole Vault","10")
group[3][0]=new Option("Events Available","0")
group[3][1]=new Option("60m","1")
group[3][2]=new Option("60m Hurdles","2")
group[3][3]=new Option("200m","3")
group[3][4]=new Option("400m","4")
group[3][5]=new Option("800m","5")
group[3][6]=new Option("1500m","6")
group[3][7]=new Option("Shot Putt","7")
group[3][8]=new Option("High Jump","8")
group[3][9]=new Option("Long Jump","9")
group[4][0]=new Option("Events Available","0")
group[4][1]=new Option("60m","1")
group[4][2]=new Option("60m Hurdles","2")
group[4][3]=new Option("200m","3")
group[4][4]=new Option("400m","4")
group[4][5]=new Option("800m","5")
group[4][6]=new Option("1500m","6")
group[4][7]=new Option("Shot Putt","7")
group[4][8]=new Option("High Jump","8")
group[4][9]=new Option("Long Jump","9")
group[4][10]=new Option("Pole Vault","10")
var temp1=document.entry_details.event1
var temp2=document.entry_details.event2
var temp3=document.entry_details.event3
var temp4=document.entry_details.event4
var temp5=document.entry_details.event5
var temp6=document.entry_details.event6
function populate_it(x){
for (m=temp1.options.length-1;m>0;m--)
temp1.options[m]=null
for (m=temp2.options.length-1;m>0;m--)
temp2.options[m]=null
for (m=temp3.options.length-1;m>0;m--)
temp3.options[m]=null
for (m=temp4.options.length-1;m>0;m--)
temp4.options[m]=null
for (m=temp5.options.length-1;m>0;m--)
temp5.options[m]=null
for (m=temp6.options.length-1;m>0;m--)
temp6.options[m]=null
for (i=0;i<group[x].length;i++){
temp1.options=new Option(group[x].text,group[x][i].value)
[i]temp2.options[i]=new Option(group[x].text,group[x][i].value)
[i]temp3.options[i]=new Option(group[x].text,group[x][i].value)
[i]temp4.options[i]=new Option(group[x].text,group[x][i].value)
[i]temp5.options[i]=new Option(group[x].text,group[x][i].value)
[i]temp6.options[i]=new Option(group[x].text,group[x][i].value)
}
temp1.options[0].selected=true
temp2.options[0].selected=true
temp3.options[0].selected=true
temp4.options[0].selected=true
temp5.options[0].selected=true
temp6.options[0].selected=true
}
</script>
<!--close the head section -->
</HEAD>
[i]<!-- Now declare the body section -->
<BODY bgColor=#ffffff topMargin=0>
<form action="http://" method="POST" name="entry_details" id="entry_details">
<FONT color="#003399" size=3 face="tahoma, helvetica"><B> <FONT color=#003399
size=5 face="Arial, Helvetica, sans-serif"><br>
</FONT> </b></font><font face="tahoma, helvetica" size=2><b>
<select name="g_age" id="select2" onChange="populate_it(g_age.options.value)">
<option value="0" selected>Available Groups</option>
<option value="1" >Girls under 16</option>
<option value="2">Girls over 16</option>
<option value="3">Boys under 16</option>
<option value="4">Boys over 16</option>
</select>
</b></font>
<p><FONT color="#003399" size=3 face="tahoma, helvetica"><B> <FONT color=#003399 size="4" face="Arial, Helvetica, sans-serif">Event</FONT><FONT color=#003399
size=4>
<select name="event1" id="event1">
<option value="1">Events available</option>
</select>
</FONT><font color="#003399" size=4 face="tahoma, helvetica"><br>
</font><FONT color=#003399 size="4" face="Arial, Helvetica, sans-serif">Event</FONT><FONT color=#003399
size=4>
<select name="event2" id="event2">
<option value="1">Events available</option>
</select>
</FONT> <br>
<FONT color=#003399 size="4" face="Arial, Helvetica, sans-serif">Event</FONT><FONT color=#003399
size=4>
<select name="event3" id="event3">
<option value="1">Events available</option>
</select>
</FONT> <br>
<FONT color=#003399 size="4" face="Arial, Helvetica, sans-serif">Event</FONT><FONT color=#003399
size=4>
<select name="event4" id="event4">
<option value="1">Events available</option>
</select>
</FONT><FONT color="#003399" size=4 face="tahoma, helvetica"><br>
</FONT><FONT color=#003399 size="4" face="Arial, Helvetica, sans-serif">Event</FONT><FONT color=#003399
size=4>
<select name="event5" id="event5">
<option value="1">Events available</option>
</select>
</FONT> <br>
<FONT color=#003399 size="4" face="Arial, Helvetica, sans-serif">Event</FONT><FONT color=#003399
size=4>
<select name="event6" id="event6">
<option value="1">Events available</option>
</select>
</FONT></b></font></p>
<FONT color=#003399 size="3" face="tahoma, helvetica"><B> </B></font>
<p><FONT color="#003399" size=3 face="tahoma, helvetica"><B>
</b></font></p>
</form>
<FONT color="#003399" size=3 face="tahoma, helvetica"><B>
<P align=center> </P>
<P> </P>
</b></font>
</BODY>
</HTML>