云在飞mp3下载:怎样判断vbscript输入的不是中文字符?

来源:百度文库 编辑:中科新闻网 时间:2024/04/29 17:13:25

<script language="vbscript">
Function chk()
if userName.value="" then
msgbox("不能为空!")
userName.focus()
window.event.returnValue=false
exit function
end if

dim str,re,rv,Match
str=userName.value
Set re = New RegExp
re.Pattern="^[\u4e00-\u9fa5]*$"
re.Global=True
set rv=re.Execute(str)

For Each Match in rv
RetStr =Match.Length
Next

if(RetStr=Empty) then
msgbox("姓名必须全为中文")
username.value=""
userName.focus()
window.event.returnValue=false
exit function
else
msgbox("正确")
end if
end Function
</script>
<input name="userName" type="text">
<input type="button" onclick="chk()" value="确定">

if Asc(输入内容)>0 then 它不是中文字符