View Full Version : Code to close window
Mayeb the obvious has escaped me -- but can someone tell me the HTML code for a link on my page, which, when clicked, will close the window"
John
Mirzabah
6-18-02, 01:28 AM
Originally posted by johnw
Mayeb the obvious has escaped me -- but can someone tell me the HTML code for a link on my page, which, when clicked, will close the window"<a href="javascript:close ()">Close</a>Or, using a form:<form action="javascript:close()" method="post">
<input type="submit" value="Close">
</form>
PS. It looks like vBulletin is inserting a space in "javascript" in my code examples. "javascript" should be one word...
alphadesk
6-18-02, 01:29 AM
Try this.
<a href="#" onClick="window.close(); return false;">Close Window</a>
Thanks to you both for your promopt and timely help. Mirzabah, I can understand you being on line -- it's mid afternoon for both of us -- but what time is it where the AlphaDesk lives? You doing an all-nighter mate?
Cheers
John
alphadesk
6-18-02, 01:38 AM
As a Neal Young song says. Rust never sleeps!
Here's the back forward link code also.
<a href="#" onClick="window.history.back(); return false;">Back</a>
<a href="#" onClick="window.history.forward(); return false;">Forward</a>
In both cases the page closed, but gave me a 404 page could not be found message, but with different stuff after the URL eg http://www.jaywey.com/qm/%3Ca%20href=%22java%20script:close%20()%22%3EClose %3C/a%3E
Sorry to be a bugger, but any ideas?
John
alphadesk
6-18-02, 02:11 AM
I'm not sure what went haywire. It seems to work. Just do a view source and copy and paste.
Close Window (http://www.alphadesk.net/temp/close.htm)
Mirzabah
6-18-02, 02:18 AM
Originally posted by johnw
In both cases the page closed, but gave me a 404 page could not be found message, but with different stuff after the URL eg http://www.jaywey.com/qm/%3Ca%20href=%22java%20script:close%20()%22%3EClose %3C/a%3E
Sorry to be a bugger, but any ideas?Make sure you remove that space between "java" and "script". In the message I posted, vBulletin inserted a space where it shouldn't have - perhaps it's a hack to prevent script kiddies posting malicious code in vBulletin forums...
It also looks like you may have pasted the code incorrectly - there's a lot of junk in that URL. Try typing the code in instead of cutting-and-pasting.
I'll have another try later tonight -- time to pick up the kids from day care
In the mean time, you can have a look at the whole project http://qm.jaywey.com -- buy for free while I'm still testing . . . and maybe let me know what you think!
Thanks again for everything
John
I think my problem was from pasting the code into the Link tab in Dreamweaver, instead of direct on the page.
It works when pasted direct into the page.
Thanks again for all your help.
John
vBulletin v3.6.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.