PDA

View Full Version : changing a url


PeterJS
01-04-2003, 08:00 PM
Hi,

I have this code so far.......

for(var i=1 ; i<document.links.length ; i++) {
if(document.links[i].href="URL To Be Replaced") {
document.links[i].href='New URL HERE';}
}

I wondered if someone could give me a hand to get it working properly. At the moment it changes every link on the page to the new link. But I need it to just replace the old link with the new one. I don't have access to the html so I need to use Javascript to change the URL.

Hope someone can offer me some advice to get it working

Thanks

Peter :)

Borgtex
01-04-2003, 08:10 PM
just change = for ==

for(var i=1 ; i<document.links.length ; i++) {
if(document.links[i].href == "URL To Be Replaced") {
document.links[i].href='New URL HERE';}
}

PeterJS
01-05-2003, 01:24 AM
Thanks :)

Peter