Hi all,

This should not be off-topic...

I've seen more and more of this fiddling with DTD's lately, and I'm not sure it is a wise thing for us to be going off the standard in order to bring back the target attribute --or any other attribute really... if we open that can of worms then we can all have our own versions of xhtml --, especially since the target attribute is not required to open a link in a new window. I found a little explanation of how to open new windows with just a little javascript and an existing attribute to anchor tags, "rel". I wish I could remember where I saw this, but the technique is simple. In all your external links, place rel="external", and the following javascript, (I prefer to put all my js in an external document):

window.onload = function() {
        externalLinks();
}

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";
        }
 }

So with this, your documents will still validate on the W3C DTD. The downside is that it won't work on really old browsers, but my personal opinion on that is we should take them off life-support wherever possible anyway. I'd really like to see a discussion on this XHTML extensions/personal DTD issue. I know this is the power of XML, but the reason why certain attributes were left out of XHTML was because the W3C felt they were the job of Javascript, not markup, and as we see here, the javascript can act on any attribute in XHTML, not just "target".

Nelson
-------------------------------------------
Vancouver, BC
www.nelsonford.net

*****************************************************
The discussion list for http://webstandardsgroup.org/
See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
*****************************************************




Reply via email to