Link to home
Start Free TrialLog in
Avatar of dr34m3rs
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.submit();
}

//-->
</SCRIPT>



Desired code:

<SCRIPT LANGUAGE="JavaScript">
<!--

function body_OnLoad()
{
         if(exist.childWindow_name)
         {
         document.form_SleepChild.submit();
         }
}

//-->
</SCRIPT>


Any help would be much appreciated.

Thank you :)
ASKER CERTIFIED SOLUTION
Avatar of James Rodgers
James Rodgers
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dr34m3rs
dr34m3rs

ASKER

Ok that worked great Jester_48, so I will accept your answer.

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 :)
The error I get is wildchild undefined...
nevermind I solved it :)

Thanks.
thanks for the points