theflyingminstr
11-17-2010, 02:52 AM
Hi is there a way to only allow a certain numeric amount to be entered into a text input? i.e, Like nothing over 20?
Thanks
Thanks
|
||||
Only Allow Certain Amount in Textbox Inputtheflyingminstr 11-17-2010, 02:52 AM Hi is there a way to only allow a certain numeric amount to be entered into a text input? i.e, Like nothing over 20? Thanks connollyc4 11-17-2010, 03:22 AM Hi is there a way to only allow a certain numeric amount to be entered into a text input? i.e, Like nothing over 20? Thanks Yes. Check Post number 10 from Philip M. http://codingforums.com/showthread.php?t=207805 theflyingminstr 11-17-2010, 03:41 AM Nifty, thanks! Philip M 11-17-2010, 07:47 AM Well, if we are talking about one textbox only it is simple:- <input type = "text" id = "mytextbox" size = "2" maxlength = "2" onblur = "chk(this)"> <script type = "text/javascript"> function chk(which) { var val = which.value; if (val > 20) { alert ("The maximum value allowed is 20"); which.value = ""; setTimeout("document.getElementById('" + which.id + "').focus()", 25); } } </script> "To get back my youth I would do anything in the world, except take exercise, get up early, or be respectable." - Oscar Wilde (Irish Poet, Novelist, Dramatist and Critic, 1854-1900) |
| |||
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum