PDA

View Full Version : setting window.onerror for IFRAME



sunisha
08-03-2005, 04:47 PM
I am trying to set an error handler for an IFRAME's contents to the error handler defined on the parent document...

window.onerror = myError;

for (frame=0; frame < document.frames.length; frame++)
{
document.frames[frame].onerror = myError;
}

but it seems that when i set the onerror, JavaScript is interpreting this as a dynamic property and assiging the string representation (the function) of the function myError and not setting it as an event handler. i have seen documentation state that the frames collection of the document "retrieves a collection of all window objects defined by the given document or defined by the document associated with the given window".

is this possible to do in JavaScript? thanks for your help!

Sunish

Twey
08-03-2005, 06:38 PM
document.frames doesn't exist - at least in Firefox, which is DOM-compliant. This may be your problem.