Help! Need this to open in new window upon submission.

Discussion in 'JavaScript' started by profitshare, Jul 21, 2007.

  1. #1
    <script type="text/javascript">
    function getURL(val){
       if(!val){
          alert('Who were you Referred By? (Access Code)');
          return false;
       }
       else{
          base = 'http://www.freecardmatrix.com/index.aspx?refid=';
          location = base + val;
          return false;
       }
    }
    </script>
    </head>
    
    <body>
    <form id="form1" name="form1" method="post" action="" onsubmit="return getURL(this.url.value)">
      <label>
      <input type="text" name="url" />
      </label>
      <label>
      <input type="submit" name="Submit" value="Enter" />
      </label>
    </form>
    </body>
    </html>
    Code (markup):

     
    profitshare, Jul 21, 2007 IP
  2. in2clearsky

    in2clearsky Peon

    Messages:
    121
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try to put target="xxx" in you form. Where xxx is "_blank" or "_new", can't remember.

    <form id="form1" name="form1" method="post" action="" onsubmit="return getURL(this.url.value)" target="xxx">
     
    in2clearsky, Jul 24, 2007 IP
  3. gibex

    gibex Active Member

    Messages:
    1,060
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    95
    #3
    instead of location use location.href
     
    gibex, Jul 25, 2007 IP