> My present website has a couple of href that need to
> open in their own window. When I had the xhtml
> validated it said that target=_blank was invalid, my
> only error.
>
> Why and is there a css solution for this dilemma? I
> would like to keep my xhtml strict error free.
>
> Also why is a blank space in a id name="content " a
> unholy disaster. It took me 2 days to find out why it
> worked fine in ie and was a disaster in ff.
>
> MJ
>

MJ,

This is off topic for this list.  None-the-less here is the answer.

If you want to use XFN[1] in the links that you want to go offsite use the  
rel attribute:

<a href="yourlinkdestination.html" rel="off-site">Link Text</a>

"rel" is to show the relationship between your site and the site linked to.

Then use javascript to apply onlick events, here is the following code for  
that.  This code adds the onclick events once the page is loaded.  This  
way you don't have to put javascript in your code and if people disable  
javascript your page still works.


function offsite() {
        if (!document.getElementsByTagName) return false;
        
        var links = document.getElementsByTagName("A");
        
        for ( var i = 0; i < links.length; i++ )
        {
                var attributeValue = links[i].getAttribute("rel");
                if (attributeValue.search(/off-site/) != -1)
                {
                        links[i].onclick = function() {
                                if(!document.getElementById) return true;
                                //open a new window with the anchors url
                                window.open(this.getAttribute("href"));
                                return false;
                        }
                }
        }
}

function addLoadEvent(func) {
        var oldOnLoad = window.onload
        if (typeof window.onload != 'function')
        {
                window.onload = func;
        }
        else {
                window.onload = function() {
                        oldOnLoad();
                        func();
                }
        }
}

addLoadEvent(offsite);


You don't have to use the rel if you don't want you, can use a class named  
"off-site" just change the attribute you are getting.(hint)

We are using the class version on Virginia Tech's[2] new site.

If you need more help just email me back off list.

Nick


[1] http://gmpg.org/xfn/
[2] http://www.vt.edu/
-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
IE7b2 testing hub -- http://css-discuss.incutio.com/?page=IE7
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to