Click to See Complete Forum and Search --> : Automatic link target?


Infamous JC
02-07-2007, 02:33 PM
We all know in <a> tags, we can add target="_blank". But is there a way to automatically set links to open in a new window, by putting a separate code in the header/body? Any help would be appreciated.

Charles
02-07-2007, 02:37 PM
We all know in <a> tags, we can add target="_blank". That's not such a great way to do things. Better to use JavaScript:<script type="text/javascript">
onload = function () {
var l, i = 0
while (l = document.links[i++]) {
l.onclick = function () {
window.open (this.href, 'child')
return false
}
}
}
</script>

Infamous JC
02-07-2007, 03:24 PM
Okay.. where do I put this? ;p

Edit : Nevermind, I got it. Thanks :D