Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 12-01-2009
Member
 
Join Date: May 2008
Posts: 923
HTML code to close window

On a site on which I'm working right now, whenever a user selects something a small window pops up with a description on it. I want to put a button on this windows that says "Close this Window". Can anyone help me out and guide me the code of this?
Reply With Quote
  #2  
Old 12-01-2009
Member
 
Join Date: May 2008
Posts: 3,971
Re: HTML code to close window

You can simply use the following code:

Code:
<input type=button value="close window" onclick="window.close()">
Reply With Quote
  #3  
Old 12-01-2009
Member
 
Join Date: May 2008
Posts: 685
Re: HTML code to close window

If you would like to close a window, this JavaScript code will enable you to do just that. This JavaScript code will enable your users to close a window simply by clicking on a link.

Place this code within your HTML code where you would like the button to appear:

Code:
<a href="javascript: self.close()">Close Window</a>
Reply With Quote
  #4  
Old 12-01-2009
Member
 
Join Date: May 2008
Posts: 804
Re: HTML code to close window

To close a window using a button:

Code:
<form>
<input type="button" value="Close Window" onClick="self.close()">
</form>
To close a window using a (simple) link:

Code:
<font face="arial, helvetica" size="-2"><a href="javascript:self.close()" target="_self">Close window</a></font>
To close a window:

HTML Code:
<html>
<head>
<title>FunctionX Tutorials</title>
</head>
<body>
To close a window using a text link<br>
<a href="javascript:window.close();">Close</a>
</body>
</html>
Reply With Quote
  #5  
Old 12-01-2009
Member
 
Join Date: May 2008
Posts: 923
Re: HTML code to close window

Is this code browser dependent? Does it work under Firefox also?
Reply With Quote
  #6  
Old 12-01-2009
Member
 
Join Date: May 2008
Posts: 1,180
Re: HTML code to close window

Below code worked for me in Firefox. Just put this code in a test page and try it:

HTML Code:
<html>
<title>SSOne (javascript: Close Window)</title>
<body bgcolor="#FFFFFF">
<a href="javascript:window.close();">Close This Window</a>
<br>
<form>
<input type=button value="Close This Window" onClick="javascript:window.close();">
</form>
</body>
</html>
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "HTML code to close window"
Thread Thread Starter Forum Replies Last Post
cannot close Logitech Webcam Help window Adisa Windows Software 2 30-12-2011 04:48 AM
Close window JavaScript Jensen Ackles Software Development 6 13-05-2010 12:16 PM
Problem with close window in PHP Duck Software Development 3 08-04-2009 08:57 AM
Need to close All Window Aakarshan.d Operating Systems 4 12-02-2009 08:58 AM
How do I get the HTML code to display as HTML code? NAYASA Software Development 3 26-12-2008 01:35 PM


All times are GMT +5.5. The time now is 11:13 AM.