Question on input box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • codeex
    New Member
    • Mar 2007
    • 24

    Question on input box

    How would i make this work without using the input button. to make it so they can hit enter and it will check the password??

    Code:
     
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
        <html>
            <head>
                <title>Coming...</title>
                    <script type="text/javascript">
    		function CheckMe()
    		{
    		var strPassword = document.getElementById("strPassword").value
    		if (strPassword == "New England Clam Chowder")
    			{
    				window.location="http://google.com"
    			}
    			else
    			{
    				alert("No Way Jose")
    			}
    		}
    		
    
    
    
    		</script>
            </head>
                <body>
    		The Password Is: New England Clam Chowder
                  	<form>
    			<input type="password" id="strPassword" size="25" />
    			<br />
    			<input type="button" onclick="CheckMe()" size="25" value="Submit" />
    		</form>
                </body>
    </html>
  • iam_clint
    Recognized Expert Top Contributor
    • Jul 2006
    • 1207

    #2
    a submit button will capture enter




    you can also capture the enter key's keystroke

    Comment

    • codeex
      New Member
      • Mar 2007
      • 24

      #3
      is there a way to hide the submit button, and also when i hit enter it wont work.

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        A style setting of "display:no ne" or "visibility:hid den" will hide the submit button.

        The key code for enter is 13. Check for that onkeyup. See this link.

        Comment

        Working...