PDA

View Full Version : Disable target=_blank for a bunch of links


meow
05-29-2003, 09:46 PM
I want to use a JavasScript from an external source, That is, I have no control over the actual script. I use it by embedding a script tag on the spot where I want the links to occur. What it does is document-write a bunch of links like this:

document.writeln('<a target="_blank" href="http://example com">Blah blah blah</a><br>');
document.writeln('<a target="_blank" href="http://example com">Blah blah blah</a><br>');
document.writeln('<a target="_blank" href="http://example com">Blah blah blah</a><br>');
...aso aso.

How would I go about stopping those links from opening in a new window? An old fashioned javascript solution that works in Netscape 4 wouldn't hurt. :)

Catman
05-29-2003, 10:35 PM
Maybe something like this after the links are generated:
for (aCount = 0; aCount < document.links.length; aCount++)
document.links[aCount].target = "_self";