»
EnglishFrenchVietnamese

Print - Open Links Option - JavaScriptBank.com

Full version: jsB@nk » Link » Open Links Option
URL: https://www.javascriptbank.com/open-links-option.html

Open Links Option © JavaScriptBank.comThis JavaScript will give the user the option to open links in either a new window or in the same window. Simple to set-up.

Full version: jsB@nk » Link » Open Links Option
URL: https://www.javascriptbank.com/open-links-option.html



JavaScript
<script language="javascript">// Created by: Sandeep Gangadharan :: http://www.sivamdesign.com/home/function openLink() {  for (var i=0; i<=(document.links.length-1); i++) {    if (document.form1.tick.checked == true) {document.links[i].target = "_blank"}    if (document.form1.tick.checked == false) {document.links[i].target = "_self"}  }}</script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<form name="form1"> <label for="1"><input id="1" type="checkbox" name="tick"> Open link in new window.</label></form> <a href="http://javascript.internet.com/" onclick="openLink()">The JavaScript Source</a><br> <a href="http://javascript.com/" onclick="openLink()">JavaScript.com</a><br> <a href="http://scriptsearch.com/" onclick="openLink()">ScriptSource</a><br> <a href="http://www.webdeveloper.com/forum/forumdisplay.php?f=3" onclick="openLink()">JavaScript Forums</a><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->