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 5 of 5
  1. #1
    New Coder
    Join Date
    May 2004
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts

    probably simple! can't use string variable in window.location

    x is a string variable that I can alert to myself and I know it's good. But for some reason window.location omits it. What am I not seeing?

    Code:
    function addProduct() {
      var x = '?selection=<? echo $_GET['selection']; ?>&products=';
      var frm = document.checkForm;
      // Loop through all elements
      for (i=1; i<frm.length; i++) {
        if (frm.elements[i].checked == true) {
          x += frm.elements[i].value + ',';
        }
      }
      window.location='addItem.php'+x;
    }

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    That technique worked fine for me.
    Code:
    x='?a=22222';
    window.location='page.htm'+x; //took me page.htm?a=22222

  • #3
    New Coder
    Join Date
    May 2004
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Works in IE but not in FF?!?

  • #4
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    I didn't try IE, worked in FF.

  • #5
    New Coder
    Join Date
    May 2004
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Not sure what changed, but as I was working on other things, it just started working. Maybe cache.


  •  

    Posting Permissions

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