<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div class="input-choseNum">
<input type="number" id="num" onblur="zhenshu()"/>
<span class="sureChoose">确定</span><span class="closeChoose">取消</span>
</div>
</body>
<script type="text/javascript">
function zhenshu(){
var num = document.getElementById(‘num‘).value;
if(!(/^[1-9]*[1-9][0-9]*$/.test(num))){
alert("请输入大于0的数字");
return false;
}
}
</script>
</html>
时间: 2024-11-05 13:49:24