Results 1 to 3 of 3

Thread: load function

  1. #1
    Join Date
    Jul 2006
    Posts
    139
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Talking load function

    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

  2. #2
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    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
    - Mike

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    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".
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •