漢字判斷函數

<script language=javascript>
cntext=window.prompt("請輸入中文:");
</script>

<script language=vbs>
function isChinese(para)
on error resume next
if isNUll(para) then
isChinese=false
exit function
end if
if trim(para)="" then
isChinese=false
exit function
end if
dim c
for i=1 to len(para)
c=asc(mid(para,i,1))
if c>=0 then
isChinese=false
exit function
end if
next
isChinese=true
if err.number<>0 then err.clear
end function

if not isChinese(cntext) then
alert("請輸入漢字!")
else
alert("您輸入的漢字是:" & cntext)
end if
</script>

發佈了11 篇原創文章 · 獲贊 3 · 訪問量 10萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章