PDA

View Full Version : Javascript to search and replace HREF=



chris_quan
10-20-2004, 08:17 AM
All,

Is there a way to use Javascript to search and replace all link in the body with a new value? My search engine generates links with Mapped drive which causes problems with Firefox and Netscape (works fine with IE).

For example, on each of the search result, the link HREF="C:\Test\test\test.html" should be replaced with HREF="http://www.abc.com/test/test.html" ???.

Since these search result are dynamic, maybe I could use Onload on the body and searc&replace all of the HREF="C:\Test\test\ with HREF="http://www.abc.com/test All links start with HREF="C:\Test\test\

Is this possible? If it is, sample code, please.

Thank you.

Chris

cr3ative
10-20-2004, 01:12 PM
There isn't a way that I know of to do this, as I don't think Javascript has the capability to parse HTML.

Use notepad on your HTML file to replace c:\test\test with www.yourhost.com/ if need be. Which HTML generator are you using?

cr3ative