Posted By

BebenKoben on 03/24/11


Tagged

javascript


Versions (?)

Open All Links With Checklist Method


 / Published in: JavaScript
 

  1. <script type="text/javascript">
  2. //<![CDATA[
  3. <!--
  4. // code hack by Beben Koben
  5. function targetLinks(newWin)
  6. {
  7. if (newWin) where = "_blank";
  8. else where = "_self";
  9. for (var i=0; i<=(document.links.length-1); i++)
  10. {
  11. document.links[i].target = where;
  12. }
  13. }
  14. //-->
  15. //]]>
  16. </script>
  17.  
  18. <p><input name="targetnewtargetnew" onclick="targetLinks(this.checked)" type="checkbox"> Links open new windows!</p>

Report this snippet  

You need to login to post a comment.