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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cancel Button

Status
Not open for further replies.

axman505

Technical User
Jun 20, 2001
489
US
I have an edit form that opens on a new window. I have added a cancel button which i want to close the form. I have tried the following code variations for the button, but nothing works. Any suggestions? Thanks.

Code:
<input type="button" value="cancel" onclick="javascript:close()"/>

<input type="button" value="cancel" onclick="javascript:this.close()"/>
 
Try
Code:
<input type="button" value="cancel" onclick="window.close()"/>
 
close() by itself (your first example) doesn't do anything. The 'this' in this.close() refers to the button.

When you write this: onclick="window.close()" (Kendel's suggestion), it might work. To be sure, make it this:

Code:
onclick="opener=self;window.close()"

'hope that helps.

--Dave
 
or you might want to be doing :

<input type="button" value="Cancel" onclick="document.whateverForm.style.visibility=none;">

to hide the form instead of flat out closing the window.. not overly sure what you're trying to do

[thumbsup2]DreX
aKa - Robert
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top