#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    31
    Rep Power
    3

    Pretty simple form question


    I have a form that submits to a javascript function and the function opens a window. pretty simple and it works great except that it returns false in some browsers and actually replaces all the content of the parent window with the word "false" what am I doing wrong?

    Here's my code:

    Code:
    <script language="javascript">
    function bonus(){
    	//alert(document.bonus.code.value);
    	var feature = "/interactive/index.php?code=" + document.bonus.code.value;
    	window.open(feature,'1352258393691','width=700,height=500,toolbar=0,menubar=0,location=0,status=1,scrollbars=0,resizable=1,left=0,top=0,srolling=no');
    }
    </script>
    
    <div style="position: absolute; z-index: 100; left: 850px; top: 147px; border: 0px;">
    <form name="bonus" action="javascript:bonus();">
    <input type="text" name="code" size="25" style="border: 2px solid black; width: 160px; height 50px;" value="Type Your Bonus Code" onclick="this.value='';"> 
    <input type="submit" value=" Go ">
    </form>
    I also tried it with onsubmit, same problem. Thanx
  2. #2
  3. A Not To Shabby Code Smurf
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Aug 2008
    Posts
    1,187
    Rep Power
    184
    Code:
    <form name="bonus" onsubmit="return false">
    <input type="text" name="code" size="25" style="border: 2px solid black; width: 160px; height 50px;" value="Type Your Bonus Code" onclick="this.value='';"/> 
    <input type="submit" value=" Go " onclick="bonus()"/>
    </form>
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    31
    Rep Power
    3

    Thank you


    Thank you, it works great!

IMN logo majestic logo threadwatch logo seochat tools logo