P
palak123i
Hi All,
I am using a javascript to submit a request using AJAX. Part of
javascript code as follows:
var favElement = document.getElementById('fav1');
alert(favElement);
for (var i = 0; i < userGroupArray.length; i++){
for (var j = 0; j < favElement.length; j++){
if(favElement.options[j].value == userGroupArray){
favElement.options[j].selected = true;
}
}
}
fav1 is a html select element with attribute multiple="true" (please
see snipet below)
<select class="" multiple size="4" name="fav1">
<option value="">-- select --</option>
<option value='10' >1100</option>
.....
</select>
In IE 6.0, alert(favElement) returns object properly and rest of the
code works fine...
In FireFox 1.5, alert(favElement) returns null...
In Netscape 7.0 , alert(favElement) does nothing
So the code is failing in Firefox and Netscape. Can anybody suggest,
whats wrong? document.getElementById does not work in Firefox/
Netscape?
Thanks in advance,
Palak
I am using a javascript to submit a request using AJAX. Part of
javascript code as follows:
var favElement = document.getElementById('fav1');
alert(favElement);
for (var i = 0; i < userGroupArray.length; i++){
for (var j = 0; j < favElement.length; j++){
if(favElement.options[j].value == userGroupArray){
favElement.options[j].selected = true;
}
}
}
fav1 is a html select element with attribute multiple="true" (please
see snipet below)
<select class="" multiple size="4" name="fav1">
<option value="">-- select --</option>
<option value='10' >1100</option>
.....
</select>
In IE 6.0, alert(favElement) returns object properly and rest of the
code works fine...
In FireFox 1.5, alert(favElement) returns null...
In Netscape 7.0 , alert(favElement) does nothing
So the code is failing in Firefox and Netscape. Can anybody suggest,
whats wrong? document.getElementById does not work in Firefox/
Netscape?
Thanks in advance,
Palak