var anchors = document.getElementById('div').getElementsByTagName('a');
var sDom = document.domain;
for (var i=0; i<anchors.length; i++) {
var anchor = anchors[i];
if (anchor.getAttribute("href")) {
iPosition = anchor.href.indexOf(sDom);
if (iPosition == -1 ||
iPosition > sDom.length) {
anchor.target = "_blank";
}
}
}
Tuesday, June 16, 2009
Adding "_blank" of all links
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment