Force all links on page to open in new window (javascript)
function ForceLinks(){// It will tell u how many no of tags your code havevar linkslength= document.getElementsByTagName('a').length; // Putting tag in links variable to use it for array purposevar links=document.getElementsByTagName('a');for(var i = 0; i < linkslength; ++i){ links[i].setAttribute('target','_blank');} }
Now just call this function in your body onload event<body önload="ForceLinks();">
No comments:
Post a Comment