[wp-hackers] XHTML Strict compliant replacement for target=_new
Luc Saint-Elie
lstelie at gmail.com
Thu Oct 20 22:30:46 GMT 2005
2005/10/20, Geoffrey Lane <geoff at zorched.net>:
>
> Hi, I'm new to the list and new to WordPress (just got it yesterday, and
> I think it's great so far).
>
> One issue I had with adding sidebar links was the target=_new not being
> compliant with XHTML Strict. There's an easy way to emulate that
> behavior with an onclick event:
Hello,
I use rel="external"
and a JS bit of code
/*
http://www.sitepoint.com/article/standards-compliant-world
--------------------------------------------------------- */
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;
--
Luc Saint-Elie
Domaine de l'étang sec
2, allée de Gascogne
78170 La Celle Saint-Cloud
Mail: lstelie at gmail.com
Tel (FreeBox) : 08 70 73 20 28
Mob : 06 12 90 19 65
http://audioblog.fr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://comox.textdrive.com/pipermail/wp-hackers/attachments/20051020/ca77776c/attachment.htm
More information about the wp-hackers
mailing list