<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>
汉字判断函数
最新推荐文章于 2023-04-01 22:28:33 发布
本文提供了一段使用 JavaScript 和 VBS 脚本语言编写的简单程序,该程序用于提示用户输入中文,并验证输入是否为有效的汉字。如果输入的内容不是汉字,则会提示用户重新输入;若输入正确,则会显示用户所输入的汉字。
1316

被折叠的 条评论
为什么被折叠?



