SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Dec 2000
    Location
    Norcross, GA
    Posts
    136
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    window.location.replace - absolutely not working

    I am close to pulling my hair out with this autorun menu I'm working on.

    I finally have the button problem worked out, and the problem with the forms in my other post.

    Now, though, I have a new problem.

    I've been to a few different sites to confirm syntax of window.location.replace, and have copied and pasted code into my script to first make sure thiers is working right -- it was. I made the changes to the path so teh correct page would load and for some unknown reason the dang redirect is not working at all now.

    Here's the code:

    Code:
    function Form1_Validator001(theForm) {
    
    	// Test PW for validity.
        pw = new String(theForm.pw.value);
        if(pw == "") {
    		alert("A password is required to install this software.");
    		return (false);
        }
    
        if(pw == "aeiou") {
    		// pw ok, do stuff
    
    		alert("about to make redirect line call...");
    		doRedirect();
    		alert("and back to form validator loop...");
    		// alert("i just called the window.location line... and will now continue...");
    		return (true);
    
        } else {
    		alert("Incorrect password");
    		return (false);
    	}
    
    }
    function doRedirect() {
    	var path = "Support/Extras/Program/program.html";
    	alert("about to issue redirect...");
    	window.location.replace( path );
    	alert("redirect issued...");
    }
    As you can see I've added in alert boxes so I can see what's happening. They aren't providing any clues however. I'm getting zero errors, but the redirect does not work -- the thread returns to the validation loop and the "redirect issued" alert box appears.

    Please help, I'm losing my mind with this!
    Last edited by mstembri; Jan 23, 2002 at 22:01.
    - Mike
    http://www.georgiaoffroad.com

  2. #2
    SitePoint Zealot
    Join Date
    Dec 2000
    Location
    Norcross, GA
    Posts
    136
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is IE playing tricks on me?


    This works great by itself:

    <script>
    window.location.replace("otherpage.html");
    </script>

    But stick it in the example above and it flat don't work.

    Please, please help. It's late and all I want to do is finish this stinkin' script and hit the sack.
    Last edited by mstembri; Jan 23, 2002 at 22:16.
    - Mike
    http://www.georgiaoffroad.com

  3. #3
    SitePoint Zealot
    Join Date
    Dec 2000
    Location
    Norcross, GA
    Posts
    136
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Finally.......

    I put: return(false); after the redirect and got it working.
    - Mike
    http://www.georgiaoffroad.com


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
  •