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!! Link to comment https://forums.phpfreaks.com/topic/33743-how-to-validate-this/ 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] Link to comment https://forums.phpfreaks.com/topic/33743-how-to-validate-this/#findComment-158425 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.. Link to comment https://forums.phpfreaks.com/topic/33743-how-to-validate-this/#findComment-158946 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.