VBScript登入框数据检验问题

来源:百度知道 编辑:UC知道 时间:2024/06/17 22:32:17
我想对输入框进行是否为空的检验,如果为空就弹出"用户名不能为空"的窗口,如果不为空就转到列外一个页面,如"Untitled-2.html"。问题是当我点击确定按钮(我用的时submit按钮)时他弹出了"用户名不能为空"的提示框,却同时也转到"Untitled-2.html"去了。正常应该不转的才对呀。。。。
下面是我的代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<script language="vbscript">
sub check()
dim theform
set theform=document.forms("form1")
if theform.text1.value="" then
msgbox "用户名不

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<script language="vbscript">
sub check()
dim theform
set theform=document.forms("form1")
if theform.text1.value="" then
msgbox "用户名不能为空"
window.form1.text1.focus()
elseif not isnumeric(theform.text1.value) then
msgbox "请输入数字!"
window.form1.text1.focus()
else
window.open("Unti