<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
<head>
<meta http-equiv=
"X-UA-Compatible"
content=
"IE=7"
/>
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
<title>首页</title>
<style type=
"text/css"
>
html,body{margin:0; padding:20px;}
</style>
</head>
<body>
<input type=
"text"
id=
"input"
/>
<script type=
"text/javascript"
>
var
text = document.getElementById(
"input"
);
text.onkeyup =
function
(){
this
.value=
this
.value.replace(/\D/g,
''
);
if
(text.value>100){
text.value = 100;
}
}
</script>
</body>
</html>