jokerofsouls Posted October 6, 2008 Share Posted October 6, 2008 I need help a little i want to have it so that you can only put numbers in the text box. would help if you could help me Quote Link to comment https://forums.phpfreaks.com/topic/127293-solved-text-box/ Share on other sites More sharing options...
dropfaith Posted October 6, 2008 Share Posted October 6, 2008 to my knowledge you require some javascript to block input which isnt my strongest field but try this <html> <head> <title>Testing</title> <script> function checkForNum(evt) { var charCode = (evt.which) ? evt.which : event.keyCode if (charCode > 31 && (charCode < 48 || charCode > 57)) return false; return true; } </script> </head> <body> <form name="tstForm"> <input id="tstField" type="text" size="10" onkeypress="return checkForNum(event);"></input> </form> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/127293-solved-text-box/#findComment-658403 Share on other sites More sharing options...
jokerofsouls Posted October 6, 2008 Author Share Posted October 6, 2008 it works thanks dogg Quote Link to comment https://forums.phpfreaks.com/topic/127293-solved-text-box/#findComment-658412 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.