Support Forums
Close Tab With Javascript. - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Webmaster Support (https://www.supportforums.net/forumdisplay.php?fid=36)
+---- Forum: Website Development (https://www.supportforums.net/forumdisplay.php?fid=43)
+---- Thread: Close Tab With Javascript. (/showthread.php?tid=20012)



Close Tab With Javascript. - Qua - 06-27-2011

Here's a simple Javascript code that will display a button, and once clicked it will activate the closeIt function which will close a tab.

If the tab with the button is the only tab you're on it closes your browser.

A good use for this could be for something like when you give rep, it says close window.

Here's the code:

Quote:<script language="JavaScript">


function closeIt() {
close();
}


</script>

<center>
<form>
<input type=button value="Your Text" onClick="closeIt()">
</form>
</center>

Thanks for reading. Oui


RE: Close Tab With Javascript. - Dr.BrokenGod - 06-29-2011

The rep idea is really great. I will try that one!


RE: Close Tab With Javascript. - Injection - 07-01-2011

thanks! I like them alot..
added to my site


RE: Close Tab With Javascript. - djakariuz - 07-02-2011

Yeah it's a good idea xD, helps a lot. This is what they use for rep thing too.