Created
September 14, 2010 20:42
-
-
Save drench/579738 to your computer and use it in GitHub Desktop.
soderbergs target=_blank code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* one way: */ | |
for (var i=0,L; L=document.links[i]; ++i) { | |
if (L.title.match(/\b(Join\s+Our\s+Mailing\s+List|Shop\s+Online)\b/i)) { | |
L.setAttribute('target', '_blank'); | |
} | |
} | |
/* another way, maybe a bit more readable: */ | |
for (var i=0,L; L=document.links[i]; ++i) { | |
if ( | |
(L.title == 'Join Our Mailing List') || | |
(L.title == 'Shop Online') | |
) | |
{ | |
L.setAttribute('target', '_blank'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment