|
|
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
|
|
|
|
|
I'm guessing it's a problem with the "this" reference in the select. You should be passing in the value of the option. Research the select/option object heirarchy.
|
|
|
|
|
|
I'm gonna bet you a #3 from McDonalds that your SELECT element looks something like this:
<option>1</option>
<option>2</option>
<option>3</option>
|
|
That will work as you expect in FF, but not in IE. The proper way to build SELECT options is this:
<option value=1>1</option>
<option value=2>2</option>
<option value=3>3</option>
|
|
THAT will work in IE and FF! Enjoy!
|
|
|
|
|
|
|
|
|
|