用正则表达式判断字符串是汉字还是拼音的js函数代码
发布时间:2016-12-29 来源:查字典编辑
摘要:复制代码代码如下:functioncheckFormat(str){if(escape(str).indexOf("%u")!=-1)ale...
复制代码 代码如下:
function checkFormat(str)
{
if (escape(str).indexOf("%u")!=-1)
alert("不能含有汉字");
else if(str.match(/D/)!=null)
{
alert('不能含有字母');
}
}