I am calling a Javascript function located in my parent window from an Iframe located in the parent during an onkeyup event.
IE complains and the debugger built into IE8 stops and highlights the ‘if block’ within this code saying –
“Object doesn’t support this kind of property or method”
PS – This bit of code works in FF!
<td class="grid" align="left">
<input type="text" name="invqty${topitem.itemIdentifier}-<c:out value = "1"/>"
id="invqty${topitem.itemIdentifier}-<c:out value = "1"/>"
value="0"
onFocus="this.select()"
onkeyup="if(!parent.validateFloat(this.id)) { this.value = '0'; }
else { parent.updateBalance(${topitem.itemIdentifier}); }">
</td>
Anyone have any ideas?
Wow!!!
So the issue was this –
I had about 5 functions that I was defining within my iframe.
They all were happening within a single ‘script block’
One of these functions was using a “for each” loop. This one loop in one of those 5 functions caused IE to IGNORE the entire ‘script block’ where I was doing this. The kicker was that the debugger within IE8 was telling me the problem was on some bogus line number where it made me think that there was an issue with my iframe and how I was trying to define my JS functions. Finally, I gave up and went and asked somebody with a MAC to debug this using Safari. The Safari debugger nailed down the exact line with the for each loop. I commented that for each loop code out and IE started working too!
Unbelievable!
The developers for the IE8 Browser Debugger should be beaten over their wrists with a yard stick for their incompetence. I wasted 3 days on this.
Kudos for the peeps at Apple.
Lessons learned here –
DON’T use “for each” loops when writing Javascript!
DON’T use Microsoft IE branded debuggers! They are terrible and will waste your time.
Thank you for your help Bergi and Nivas!