Dave_NI
11-28-2003, 07:29 AM
Hi all.
I have a generic peice of javascript which is run on ever page. Its designed to copy the contents from one form to an identical other form. It works a treat, but the problem is in the code is still run against pages with no forms, which causes a error.
Basically I need to check if the parent window has a document object... but if I reference it, I get the error.
My referencing coed is-
var parentForm = window.opener.document.forms[0];
I have tried to assign
var parentForm = window.opener.document
and check if its null but it still returns " window.opener.document is not an object".
Can I test to see if the parent has a document without it falling on its ass?
Thanks
I have a generic peice of javascript which is run on ever page. Its designed to copy the contents from one form to an identical other form. It works a treat, but the problem is in the code is still run against pages with no forms, which causes a error.
Basically I need to check if the parent window has a document object... but if I reference it, I get the error.
My referencing coed is-
var parentForm = window.opener.document.forms[0];
I have tried to assign
var parentForm = window.opener.document
and check if its null but it still returns " window.opener.document is not an object".
Can I test to see if the parent has a document without it falling on its ass?
Thanks