Open All Links With Checklist Method


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.