PDA

View Full Version : load function



neo_philiac
07-11-2006, 04:55 PM
can anyone tell me what is it that I am doing wrong in this code?
This should take me to the page if the password is ioncorrect but instead the browser says page not found
....
else{
alert("Invalid username & password")
load('wrongpage.html')
}
}
function load(url)
{
location.href=url;
}


i also tried window.location = "asdasd.html", it dosent work

mburt
07-22-2006, 04:45 PM
Well, for one you have to have the file in the same directory as the link it's coming from. Otherwise you have to write the whole thing: http://....../../wrongpage.html

Twey
07-22-2006, 10:45 PM
That's a bit oversimplified, but hits on the problem. It sounds as though the page isn't in the same directory as the script. You can use absolute URLs as mburt suggested, or, preferably, you can use relative URLs like "../wrongpage.html".