Bob's Free Stuff Forum - Find jobs - Valentine Gifts - Find jobs - HDTV

PDA

View Full Version : IE no like innerHTML? FF does...


GoldDog
May 16th 2005, 2:18 pm
Can anyone tell me why IE doesn't like this script?

My function looks like this...


var c = 0;
function reCalc(i) {
c = 10*i;
document.getElementById('subT').innerHTML = c;
}

...and the call to the function looks like this...


<select name="qty" onchange="reCalc(this.value)">

...and the page element 'subT' looks like this...


$<span id="subT">275</span>

In Mozilla subT gets rewritten to reflect the math requested in the function, but IE insists on setting the value of subT to 0 every time.

Any ideas? Thanks

frankm
May 16th 2005, 2:26 pm
GD, your problem is not the innerHTML, but the onchange.

onchange="f(this.value);" does not work in IE.
you should use something like:
si = document.forms.form1.qty.selectedIndex;
if (si > 0)
{
v = document.forms.form1.qty.options[si].value;
}

but that's from the top of my head :)

GoldDog
May 16th 2005, 3:20 pm
That was it. Thanks frankm