<html> <head> <title>禁止输入小于0的数,最小为1</title> <script type="text/javascript"> function CheckInputInt(oInput) { if ('' != oInput.value.replace(/\d/g,'')) { oInput.value = oInput.value.replace(/\D/g,''); } if(parseInt(oInput.value)<0.1){ oInput.value="1"; } } </script> </head> <body> 禁止输入小于0的数<input type="text" name="num" οnkeyup="CheckInputInt(this);" οnblur="CheckInputInt(this);" onafterpaste="CheckInputInt(this);" /> </body> </html>