<html>
<head>
<script language="JavaScript" type="text/javascript">
function alnum(str) {
var alnum = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'
for (var i = 0i <str.lengthi++) {
if (alnum.indexOf (str.charAt(i)) == -1) {
return false
}
}
return true
}
function isalnum(){
var reqWord = document.getElementById("reqWord").value
if(alnum(reqWord) == false){
alert("你输入的不是英文、数字或符号!")
}
return true
}
</script>
</head>
<body>
<input id="reqWord" type="text" value="">
<input type="button" onclick="isalnum()" value="OK">
</body>
</html>