我下面的一部分script 验证代码怎么不好使啊
<Script language="vbscript">
function CheckTxt()
if document.form1.UserName.value=="" then
alert("用户名不能为空!")
document.form1.UserName.focus()
CheckTxt=false
end if
if document.form1.UserPwd.value=="" then
alert("密码不能为空!")
document.form1.UserPwd.focus()
CheckTxt=false
end if
CheckTxt=true
end function
</script>
<form name="form1" method="post" action="yanzhen.asp" onSubmit=" return CheckTxt()" >
<td align="right"><input name="BtnSubmit" type="submit" value="登陆" onClick=" return CheckTxt()"></td>
<td><input name="BtnSubmit2" type="button" value="取消" onClick="window.close();"></td>
还有这一段数据库联接代码,也有问题啊,帮我看一下,谢谢
option explicit
dim conn,connstr,db ,strSql,Userpwd,UserName
UserName=Trim(Request.Form("UserName"))
Userpwd=Trim(Request.Form("UserPwd"))
response.write(UserName)
db="database/huayu.mdb"
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
conn.Open connstr
if UserName<>""and Userpwd <>"" then
strSql="select PassWord from User where UserTypeId='"+"3' and UserName='"+UserName
set rs=server.createobject("adodb.recordset")
rs.open strSql,conn,1,1
if(Userpwd==rs("PassWord"))
response.redirect ("houtaimain.asp")
else
response.write('<font size=12 color=red>'+"你输入的用户名或密码不正确!"+'</font>')
end if
end if
这是显示的错误
错误类型:
Microsoft JScript 编译错误 (0x800A03EC)
缺少 ';'
/2005-01-05/yanzhen.asp, line 11, column 7
option explicit
------^
浏览器类型:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
网页:
POST 43 ??? /2005-01-05/yanzhen.asp
POST Data:
UserName=a&UserPwd=s&BtnSubmit=%B5%C7%C2%BD
时间:
2007年1月6日, 12:08:40