<script type="text/javascript">
function check(str) {
if (escape(str).indexOf("%u")!=-1){
alert("不能含有汉字");
}
if(str.match(/\D/)!=null){
alert('不能含有字母');
}
}
</script>
本文介绍了一种使用JavaScript进行输入验证的方法,确保用户输入的数据不包含汉字和字母。
<script type="text/javascript">
function check(str) {
if (escape(str).indexOf("%u")!=-1){
alert("不能含有汉字");
}
if(str.match(/\D/)!=null){
alert('不能含有字母');
}
}
</script>

被折叠的 条评论
为什么被折叠?