I have been lead to believe that
function externalLinks() {
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++) {
var anchor = anchors[i];
if (anchor.getAttribute("href"))
anchor.target = "_blank";
}
}
window.onload = externalLinks;
will make ALL my links open in a new tab - however I added that to the header of my page and I'm having problems - I have
function externalLinks() { if (!document.getElementsByTagName) return; var anchors = document.getElementsByTagName("a"); for (var i=0; i
at the top of my page and they all open in the same window/tab , what am I doing wrong ):? Thanks in advance for your help!
This post has been edited by Atli: 18 June 2012 - 03:51 AM
Reason for edit:: Updated the thread title. Please be descriptive when naming your threads.

New Topic/Question
Reply



MultiQuote






|