<html>
<head><title>test</title></head>
<script language="JavaScript">
function check(str)
{
var strSource ="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.()&";
var ch;
var i;
var temp;
for (i =0;i<=(str.length-1);i++)
{
ch = str.charAt(i);
temp = strSource.indexOf(ch);
if (temp == -1)
{
return 1;
}
}
return 0;
}
function login_onsubmit(){
if(check(document.loginFrm.loginname.value)){
alert('用户名不能输入中文!')
document.loginFrm.loginname.value="";
document.loginFrm.loginname.focus();
returnfalse;
}
}
</script>
<body>
<form name="loginFrm">
<input type="text"name="loginname" οnkeyup="login_onsubmit()">
</form>
</body>
</html>