js判断字符是否包含字母汉字

<script type="text/javascript">
function check(str) {
if (escape(str).indexOf("%u")!=-1){
alert("不能含有汉字");
}
if(str.match(/\D/)!=null){
alert('不能含有字母');
}

}
</script>

猜你喜欢

转载自chiangfai.iteye.com/blog/2210679
今日推荐