网站登陆代码问题

来源:百度知道 编辑:UC知道 时间:2024/05/27 11:04:32
if q=""then
response.Write"<script>window.alert('请您输入帐号!');history.go(-1);</script>"
response.End()
end if
想让此段代码 只允许用户输入纯数字 0123456789 不允许输入 a-z 或 + - * 等符号
麻烦大家了

不错的一个用正则检测输入的字符是否为数字的代码,也是一种并不常见的写法
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312" />
<title>Untitled Document</title>
</head>
<body>
<input type="text" id="myInput" value="" />
<input type="button" value="确定" id="myButton" />
</body>
</html>
<script language="JavaScript" type="text/javascript">
function $(obj){
return document.getElementById(obj);
}
function checkIsInteger(str)