Previous Message
Next Message

if you can not target with xhtml strict

Sent by Brian Cummiskey on 5 April 2005 17:05

> Little Girl wrote:
>> If you can not targer="_blank" with xhtml strict, how are you supposed to
>> achieve the same result?

Christain Heilmann wrote this a couple days back:
You cannot replace functional attributes like target with CSS. You need 
a script to do the job for you.

Personally I am using this one:
function externallinks()
    var c=document.getElementById('content');
        var ls=c.getElementsByTagName('a');
        for(var i=0;i<ls.length;i++){
                ls[i].className+=ls[i].className?' extlink':'extlink';
                ls[i].title+='(opens in new window)';
which  gets called when the page is loaded.
    if(!document.getElementById && !document.createTextNode){return;}

It opens every link inside the element with the id content that has the 
attribute rel="external" in a new window (circumventing the illegal 
"target") and adds the class "extlink" to these links. Furthermore it 
adds a title that tells the user that this link will open in a new window.


css-discuss [EMAIL-REMOVED]]
List wiki/FAQ --
Supported by --
Previous Message
Next Message

Message thread: