<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>INPUT只能是大于10的正数可以是浮点数</title>
<script language="javascript">
function CheckInputIntFloat(oInput)
{
if('' != oInput.value.replace(/\d{1,}\.{0,1}\d{0,}/,''))
{
oInput.value = oInput.value.match(/\d{1,}\.{0,1}\d{0,}/) == null ? '' :oInput.value.match(/\d{1,}\.{0,1}\d{0,}/);
if(oInput.value<10){
oInput.value = 10;
}
}
}
</script>
</head>
<body>
<form action="XXOO" name="uForm" method="post">
<input type="text" name="Money" width="15" style="IME-MODE: disabled;" οnkeyup="CheckInputIntFloat(this)" onafterpaste="this.value=this.value.replace(/\D/g,'')" />
</form>
</body>
</html>
JS正则之INPUT只能正数、浮点数
最新推荐文章于 2022-04-17 22:33:20 发布