dr34m3rs
asked on
Javascript: if child doesn't exist, don't try and close it.
I am new to javascript so I am not sure how to word my code.
I have a perl script which comes back to the same html page more than once, but the child window isn't always open... and the code I have will try and close the window even if it doesn't exist. I need to check to see if the child window exists first.
Current code:
<SCRIPT LANGUAGE="JavaScript">
<!--
function body_OnLoad() {
document.form_SleepChild.s ubmit();
}
//-->
</SCRIPT>
Desired code:
<SCRIPT LANGUAGE="JavaScript">
<!--
function body_OnLoad()
{
if(exist.childWindow_name)
{
document.form_SleepChild.s ubmit();
}
}
//-->
</SCRIPT>
Any help would be much appreciated.
Thank you :)
I have a perl script which comes back to the same html page more than once, but the child window isn't always open... and the code I have will try and close the window even if it doesn't exist. I need to check to see if the child window exists first.
Current code:
<SCRIPT LANGUAGE="JavaScript">
<!--
function body_OnLoad() {
document.form_SleepChild.s
}
//-->
</SCRIPT>
Desired code:
<SCRIPT LANGUAGE="JavaScript">
<!--
function body_OnLoad()
{
if(exist.childWindow_name)
{
document.form_SleepChild.s
}
}
//-->
</SCRIPT>
Any help would be much appreciated.
Thank you :)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The error I get is wildchild undefined...
ASKER
nevermind I solved it :)
Thanks.
Thanks.
thanks for the points
ASKER
I do get a javascript error icon on the very lower left corner of my IE browser though. Just curious if there is any way to keep this from happening?
Thank you for all your help :)