dios789
07-22-2003, 04:16 PM
How do i get all links in a list to open in a new window? :)
|
Click to See Complete Forum and Search --> : link pop-up dios789 07-22-2003, 04:16 PM How do i get all links in a list to open in a new window? :) Jona 07-22-2003, 04:19 PM Add target="_blank" to each anchor(<A> tag). [J]ona Jupac 07-22-2003, 09:12 PM This script makes all links on page open in a new window script language="JavaScript"> <!-- // Provided by clik.to/lal ! // 1)Enter your root domain below (All links containing this root will NOT open in new window): var mydomain="mypage.html" // 2)Automatically open offsite links in new window? (1=yes, 0 will render a checkbox for manual selection) var auto=1 if (!auto) document.write('<form name="targetmain"><input type="checkbox" name="targetnew" checked onClick="dynamiclink()">Open off-site links in new window</form>') function dynamiclink(){ if (auto||(!auto&&document.targetmain.targetnew.checked)){ for (i=0; i<=(document.links.length-1); i++) { if (document.links[i].hostname.indexOf(mydomain)==-1&&document.links[i].href.indexOf("http:")!=-1) document.links[i].target="_blank" } } else for (i=0; i<=(document.links.length-1); i++) { if (document.links[i].hostname.indexOf(mydomain)==-1) document.links[i].target="" } } if (auto) window.onload=dynamiclink // --> </script> webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |