Appendix of the button
-
<html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js" type="text/javascript"></script> <script lang="javascript"> function onKeyPress(event) { if (event.keyCode == 13) { val = $("input[name=name_of_input]").val(); if (val == 1) document.location.href = '65.html'; else if (val == 2) document.location.href = '43.html'; else alert("Данный код в базе не хранится!"); } } </script> </head> <body> <input type="text" name="name_of_input" onKeyPress="onKeyPress(event)"/> </body> </html>
How else do you add a button with a "check" and that she'd do the same thing as a field with a keyboard.
-
It's not the best solution (because I'm backing up your unbelievable code), but it's the idea. Add it just after your HTML field:
<button onclick="onKeyPress({keyCode: 13})">Проверить</button>