VBscript语句

来源:百度知道 编辑:UC知道 时间:2024/05/20 16:38:36
看这段代码
<html>
<body>
<script language="VBscript">
dim s,i
s=""
mm="123456"
i=0
do while not i=1
s=prompt("请输入密码")
if s=mm then
alert("密码正确")
i=1
else
alert("抱歉,你输入的密码错误,你重输")
end if
loop
</script>
</body>
</html>

在弹出提示框时,我能不能不输入密码按取消,它不给任何提示而关闭?
上述的代码我一旦按取消就提示密码错误,请重输

<html>
<body>
<script language="VBscript">
dim s,i
s=""
mm="123456"
i=0
do while not i=1
s=prompt("请输入密码")
if s="undefined" then
exit do
elseif s=mm then
alert("密码正确")
i=1
else
alert("抱歉,你输入的密码错误,你重输")
end if
loop
</script>
</body>
</html>