»
AnglaisFran�aisVietnamien

Imprimer - Ouvert Liens Option II - JavaScriptBank.com

Version compl�te: jsB@nk » Lien » Ouvert Liens Option II
URL: https://www.javascriptbank.com/open-links-option-ii.html

Ouvert Liens Option II © JavaScriptBank.comDonnez, et en afficher le radio l'option d'ouvrir les liens dans les deux une nouvelle fenêtre ou dans la même fenêtre. Simple à configurer et totalement discret.

Version compl�te: jsB@nk » Lien » Ouvert Liens Option II
URL: https://www.javascriptbank.com/open-links-option-ii.html



JavaScript
<script type="text/javascript" name="openLinks.js">// Created by: Sandeep Gangadharan / Lee Underwood :: http://www.sivamdesign.com/home/// Original: Sandeep Gangadharan// Modified: Lee Underwood// getElementsByTagName Portion: Jeremy Keithfunction openLink() {  if (!document.getElementsByTagName) return false;  var links=document.getElementsByTagName("a");  for (var i=0; i < links.length; i++) {    if (links[i].className.match("newLink")) {      links[i].onclick=function() {        for (var i=0; i<=(document.links.length-1); i++) {          if (document.form1.tick.checked == true) {            document.links[i].target = window.open            window.location.href=window.location.href          }          if (document.form1.tick.checked == false) {            document.links[i].target != window.open            window.location.href=window.location.href          }        }      }    }  }}window.onload=openLink;</script>


HTML
<form name="form1">  <small><label for="1">Open link marked with <span style="color: red;">*</span> below in new window <input id="1" type="checkbox" name="tick"></label></small></form><br><!-- Add 'class="newLink"' (w/o single quotes) to those links you want to give the user the option to open in a new window.   --> <a href="http://javascript.com/" class="newLink">JavaScript.com</a> <span style="color: red;">*</span><br> <a href="http://javascriptbank.com/">JavaScriptBank</a><br> <a href="http://www.javascriptbank.com/forum/" class="newLink">JavaScript Forums</a> <span style="color: red;">*</span>