Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2004
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    getting document.URL to change immediately

    Hello,

    I have a select box which onChange calls a function which sets the current URL using document.URL. Within that function I want to refer to a div in the new document but the div doesn't appear to exist even though I know it does. I also want to call javascript functions which belong to the new document but don't exist in the calling document.If I do

    function getNewDocument(){
    document.URL = "http://myserver/index.cfm";
    alert(document.URL) ;
    alert(document.getElementById("top"));
    }

    the 1st alert returns the URL of the document which contains the select box. the 2nd alert returns null, because there is no "top" in the original document.
    How can I make document.URL take effect immediately?

    Thanks.

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    It doesn't exist because the new page has not yet loaded. But even if the new page loads, the previous page including the script is already gone.

    What do you really want to achieve with this?
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

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