
March 27th, 2006, 11:38 AM
|
 |
Contributing User
|
|
Join Date: Jan 2005
Location: Kent, United Kingdom
Posts: 165
Time spent in forums: 2 Days 21 h 22 m 31 sec
Reputation Power: 4
|
|
|
Javascript/html form menu I.E. compatibility problem
Hi, I have been working on some javascript/html form code in order to produce a four tier drop-down menu that uses data from the previous menu to display the contents of the second and so on. It has been working fine on both browsers that I have, namely I.E. ver 5.3 and Safari (yes I have a Mac!) until I cut and pasted an extra chuck of data that I thought would not affect anything and it suddenly decided that it would not work. So I quickly stepped back my actions and re-ftp'd the page and now it will not work in ver 5.2 of I.E. or any other for PC ie ver 6, only works in Safari, Netscape and FireFox for Mac, in FireFox for PC it re-freshes the page each time a selection is made. It is driving me nuts because I don't know how to tackle a problem like this when I've gone back to the original state and now these's a browser problem.
Most of the tiers use this code:-
Code:
var OtherArray = ............etc etc
.
.
.
var PlymouthArray = new Array("('Select School type','',true,true)",
"('Plymouth Pre-School groups')",
"('Plymouth Nursery Schools')",
"('Plymouth Primary Schools')",
"('Plymouth Secondary Schools')");
function populateType(inForm,selected) {
var selectedArray = eval(selected + "Array");
while (selectedArray.length < inForm.school.options.length) {
inForm.school.options[(inForm.school.options.length - 1)] = null;
}
for (var i=0; i < selectedArray.length; i++) {
eval("inForm.school.options[i]=" + "new Option" + selectedArray[i]);
}
if (inForm.borough.options[0].value == '') {
inForm.borough.options[0]= null;
if ( navigator.appName == 'Netscape') {
if (parseInt(navigator.appVersion) < 4) {
window.history.go(0);
}
else {
if (navigator.platform == 'Win32' || navigator.platform == 'Win16') {
window.history.go(0);
}
}
}
}
}
Further down we have that section of the menu.
Code:
<select name="school" onChange="populateSchool(document.form1,document.form1.schoo l.options[document.form1.school.selectedIndex].text)">
<option value=''>Select School</option>
</select>
If anyone could tell me what approach I should take to resolve this browser problem I would be very grateful. Cheers.
|