MrProgguy

Given:

<form id="f0" name="formativeYears" action="http://www.null.org" method="get" autocomplete="off" >
<input id="i0" type="text" class="sumCellInactive" value="0.0" onfocus="return setActive(this);" onblur="return recalc();">
<input id="i1" type="text" class="sumCellInactive" value="0.0" onfocus="return setActive(this);" onblur="return recalc();">
<input id="i2" type="text" class="sumCellInactive" value="0.0" onfocus="return setActive(this);" onblur="return recalc();">
<input id="i3" type="text" class="sumCellInactive" value="0.0" onfocus="return setActive(this);" onblur="return recalc();">
<input id="i4" type="text" class="sumCellInactive" value="0.0" onfocus="return setActive(this);" onblur="return recalc();">
<input id="i5" type="text" class="sumCellInactive" value="0.0" onfocus="return setActive(this);" onblur="return recalc();">
<input id="i6" type="text" class="sumCellInactive" value="0.0" onfocus="return setActive(this);" onblur="return recalc();">
<input id="i7" type="text" class="sum" value="0.0">
</form>

I would expect to have the sum of the i0-i6 fields performed every time I tab from a field; this works in Opera9 and FF2.0, but is failing under IE7. What's odd is that I have other web-based tools that seem to work perfectly with onblur; I can't figure out what's wrong with this one. I've linted the script and validated the entire page from which this was taken, and I can't find a problem with it--which means I've been staring at it too long.

Anyone see anything



Re: Internet Explorer Web Development IE7 not firing onblur/onchange inside input elements

MrProgguy

Weird and weirder. If I grab the DOM handles to the inputs i0-i6 and assign an anonymous function to their onblur events, then it works.



Re: Internet Explorer Web Development IE7 not firing onblur/onchange inside input elements

Anonymous

I have the same problem. Can you post an example plz

Thanks

Emilio





Re: Internet Explorer Web Development IE7 not firing onblur/onchange inside input elements

MrProgguy

Sure...given the HTML you've already seen, it goes (in Java/ECMAScript) something like

var obj;

for(var idx = 0; idx < 7; ++idx)

{

obj = document.getElementById("i"+idx.toString());

if(obj !== null) {

obj.onblur = function() { return recalc(); }

obj.onfocus = function() { return setActive(this); }

}

}

and I'll leave the implementation of setActive() and recalc() to your imagination--other than to mention that they should return false no matter what they do.

I'd still like to know what the real problem is, though. I can't reproduce it reliably--just sometimes IE will work using the tag attribute assignment, and sometimes it won't.