A
atulvp
Hi all,
I have written a javascript code which changes the combo_2 options on
runtime. It is working fine on IE but not working on Firefox. Please
help me solve this problem.
My code is as follows:
function changeMe(str) {
if(str.value == "se") {
while(document.frm.combo2.length > 0) {
document.frm.combo2.remove(0);
}
var y;
y = document.createElement('option'); y.text='ONE-1';
y.value="one-1";
document.frm.combo2.add(y, 0);
y=document.createElement('option'); y.text='one-2'
document.frm.combo2.add(y, 0);
}
}
<form name="frm">
<select id="combo1" onChange="changeMe(this)">
<option value="se">Sony Erricson</option>
<option value="c2">C2</option>
</select>
<select name="combo2">
<option value="b1">B1</option>
<option value="b2">B2</option>
</select>
</form>
Kindly suggest me what am i doing wrong?
Thanks
I have written a javascript code which changes the combo_2 options on
runtime. It is working fine on IE but not working on Firefox. Please
help me solve this problem.
My code is as follows:
function changeMe(str) {
if(str.value == "se") {
while(document.frm.combo2.length > 0) {
document.frm.combo2.remove(0);
}
var y;
y = document.createElement('option'); y.text='ONE-1';
y.value="one-1";
document.frm.combo2.add(y, 0);
y=document.createElement('option'); y.text='one-2'
document.frm.combo2.add(y, 0);
}
}
<form name="frm">
<select id="combo1" onChange="changeMe(this)">
<option value="se">Sony Erricson</option>
<option value="c2">C2</option>
</select>
<select name="combo2">
<option value="b1">B1</option>
<option value="b2">B2</option>
</select>
</form>
Kindly suggest me what am i doing wrong?
Thanks