---
title: "js判断字符是否包含字母汉字"
author: "chiangfai"
date: "2015-05-13T08:27:00Z"
tags: []
categories: ["编程语言"]
slug: "js"
draft: false
lastmod: "2015-05-13T09:03:40Z"
id: 2210679
url: "https://chiangfai.iteye.com/blog/2210679"
---

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

}
</script>
```