This is probably obvious...
I would like to open a link in a new window. I used to use target="_blank"
attribute, but that isn't xhtml strict. Can anyone enlighten me on a xhtml
strict method? as I'd like my pages to verify ^^
The solution I've settled upon is to include rel='external' instead of target='_blank' on all <a> tags. Then I link a small JS file in the head of all my pages, which is this:
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;
This is all basically a straight copy from an article I found on http://www.sitepoint.com a few months back.
--- Justin French http://indent.com.au
*****************************************************
The discussion list for http://webstandardsgroup.org/
See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
*****************************************************
