Jump to content

How to close a parent window


umekille78

Recommended Posts

Hi all!As a part of a chatt page I use JS to open a new window as a result from a form. Like this:

<script>function cForm(form){window.open('','Chatt','height=700,width=750,status=no,toolbar=no,menubar=no,location=no,resizable=yes');form.target='Chatt';}</script>

The script is caled by the form. Like this:

<input name="submitButton" type="submit" value="Enter" onclick="cForm(this.form)">

Now I like to close the old window as the new one pops up. Is this posible? If so, how is it done?/Per

Link to comment
Share on other sites

Add a self.close() after you call the function.<input name="submitButton" type="submit" value="Enter" onclick="cForm(this.form);self.close()">Because you are trying to close the main window you will get an alert which the user must confirm.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...