如题,该怎么写呢,谢谢
4 回答
慕侠2389804
TA贡献1719条经验 获得超6个赞
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<input type="text" oninput="aaa(this)"/>
<script>
function aaa(obj){
var num = obj.value;
var re=/^(\-?)\d*$/;
if(!re.test(num)){
isNaN(parseInt(num))?obj.value='':obj.value=parseInt(num);
}
if(parseInt(obj.value)>90){
obj.value=parseInt(90);
};
if(parseInt(obj.value)<-90){
obj.value=-parseInt(90);
}
}
</script>
</body>
</html>
添加回答
举报
0/150
提交
取消