<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title></title>
<script type="text/javascript">
window.onload = function () {
var input01 = document.getElementById("input01");
input01.onkeydown = function () {
var keyCode = event.keyCode;
if(keyCode<48 || keyCode>57){
event.preventDefault();
//return false;
}
}
}
</script>
</head>
<body>
<label>请输入手机号</label>
<input type="text" id="input01"/>
</body>
</html>
Dom 手机号输入框
最新推荐文章于 2021-10-13 18:34:41 发布