<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):
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">