我的世界生存挖基岩:怎样判断vbscript输入的不是中文字符?

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/03 05:50:53

<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 它不是中文字符