I've been facing a problem with javascript into JS page and since I'm a newbie on it I can't figure out why this code works on Firefox but not on Google Chrome. I'd be very thankful if someone can help me with this problem.
<script type="text/javascript">
function showFC(form) {
var selElem = document.getElementById(form);
var selIndex = selElem.selectedIndex;
document.form1.S4.options[0] = new Option("C=1",1);
if(selIndex==0) {
for(var i=0;i<10;i++) {
var val = (i+1)+0.5;
document.form1.S4.options[i+1] = new Option(val,val);
}
}
}
</script>
It doesn't create dynamically elements into the select when it clicked by a button.
Here my html code:
<form name="form1" method="post" action="ComputeResult">
... other things
....
....
<select name="S4" id="S4" onclick="showFC('S4')">
<option value="1">FC</option>
<option value=""></option>
</select>
</form>