Javascript redirect w/o a pop-up.

Discussion in 'JavaScript' started by jiggawattjoseph, Sep 8, 2006.

  1. #1
    I am trying to integrate a promo section into my website. Basically, I want people to be able to enter a promo code into a form, and if the promo code is valid, be redirected to a different section of the site. It doesn't need to be particularly secure, and all the promo codes are the same. Here is the code I am using:

    if ( document.form1.password.value == "xxxxx" )
    {
    open('localpage','_self');

    } else {
    alert("Your promo code is incorrect. Please register.");
    }

    This works, but only if you substitute _blank for _self, which spawns a new browser. I want to keep the same browser window. Any ideas on how to keep this in the same window?
     
    jiggawattjoseph, Sep 8, 2006 IP
  2. noppid

    noppid gunnin' for the quota

    Messages:
    4,246
    Likes Received:
    232
    Best Answers:
    0
    Trophy Points:
    135
    #2
    Um, er, can't that password be cracked in one pageview?
     
    noppid, Sep 8, 2006 IP
  3. wmburg

    wmburg Active Member

    Messages:
    300
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    58
    #3
    window.location="promo.html";
     
    wmburg, Sep 9, 2006 IP