Quote:
Originally Posted by imagn
You can use the following JS function to mimic the target attribute. On your links you would use:
rel="external" instead of "target=_blank"
===================================
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.getAttribute("rel") == "external")
anchor.target = "_blank";
}
}
window.onload = externalLinks;
===================================
Note: If you have other "onload" elements within your body tag you'll need to move the call in the function to within the body tag.
|
We know that! It mimics something
that isn't valid. Why on Earth would you want to do that? You might as well just use the target attribute, because all this does is do the same thing without the Validator noticing.
At WebForumz, we try to improve on standards, and follow the guidelines set by
W3C, not find loopholes so we can exploit them!
Ed.