tauchai83 Posted January 11, 2007 Share Posted January 11, 2007 I create a field and only want user to enter Integer...how should I validate using JS?any1 can help me? thxs!! Quote Link to comment Share on other sites More sharing options...
Zeon Posted January 11, 2007 Share Posted January 11, 2007 [code]<script language="javascript" type="text/javascript">var lastval='' function numeric(obj,e){ if (!e) e=window.event var a = document.getElementById('a') if (obj.value.match(/^\d+$/g) || obj.value==''){ lastval=obj.value }else{ obj.value=lastval } return false }</script><input type="text" onkeyup="numeric(this,event)" />[/code] Quote Link to comment Share on other sites More sharing options...
tauchai83 Posted January 12, 2007 Author Share Posted January 12, 2007 Ok.Thanks a lot Zeon..it works well.. Quote Link to comment 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.