Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

window.close();

Status
Not open for further replies.

yellie

Programmer
Feb 10, 2003
1
CH
hello

how can I close a window, without apearing the alert asking to close?

thanks for answers.
 
I use the following form on a popup window and don't get any alert messages

<form><input type=&quot;button&quot; name=&quot;Exit&quot; value=&quot;Close&quot; onClick=&quot;javascript:exit()&quot;></form>
<script>
function exit(){
close();
}
</script> It's not a lie if you believe it!

 
You can only close popup windows without the warning. To close all windows without warning you can use the X button on the top right corner of your window.
 
Or U can use the shorter version
Code:
<INPUT TYPE=&quot;BUTTON&quot; onClick=&quot;javascript:window.close()&quot; VALUE=&quot;Close Window&quot;>
 
This is what i use:

(works in IE anyway - not tested in netscape)

Code:
<script>
function doMyClose()
{
	opener = this;
	self.close();
}
</script>
<a href=&quot;JavaScript: doMyClose();&quot;>Close this window without the 'confirm close' dialog</a>

or inline version:

Code:
<a href=&quot;JavaScript: opener = this; self.close()&quot;>Close this window without the 'confirm close' dialog</a>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top