asp输入判断代码怎么写啊!!
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/...
<!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><body><form name="form1" method="post" action="add_new.asp">帐号<input type="text" name="name"><br>密码<input type="text" name="content"><br><保护<input type="text" name="title" value=""><br><input type="submit" name="Submit" value="提交"><input type="reset" name="Submit2" value="重置"></form></body></html>比如就加一个,没输入帐号或密码的,就提示帐号密码不可以为空的代码,急啊
展开
展开全部
<script language="javascript" defer>
function myChek()
{ var v1=form1.name.value; if(v1==""){ alert("请输入用户名"); return false; }
var p1=form1.content.value; if(p1==""){ alert("请输入密码"); return false; }
//^……
return true;
}
</script>
把<form name="form1" method="post" action="add_new.asp" onSubmit="return myChek();">
function myChek()
{ var v1=form1.name.value; if(v1==""){ alert("请输入用户名"); return false; }
var p1=form1.content.value; if(p1==""){ alert("请输入密码"); return false; }
//^……
return true;
}
</script>
把<form name="form1" method="post" action="add_new.asp" onSubmit="return myChek();">
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<!__#include file="connection.asp"__>
</head>
<body>
<%
<%
dim zhanghao,mima
zhanghao=request("zhanghao")
mima=request("mima")
if zhanghao="" then
%>
<script language=javascript>
alert("帐号为空");
location.href="denglu.asp"
</script>
<% end if %>
<% if mima="" then
%>
<script language=javascript>
alert("密码为空");
location.href="denglu.asp"
</script>
<% end if %>
<%set rs=server.createobject("adodb.recordset")
rs.open "select * from student where zhanghao='"&zhanghao&"'",conn,1,3
if not rs.eof then
if mima=rs("mima") then
session("zhanghao")=zhanghao
Response.write("<script>location.href('index.asp')</script>" )
else
response.write ("<script>alert('用户密码错误');location.href('denglu.asp')</script>")
end if
end if
if rs.eof then
response.write ("<script>alert('用户帐号错误');location.href('denglu.asp')</script>")
end if
set rs=nothing
rs.close
%>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<!__#include file="connection.asp"__>
</head>
<body>
<%
<%
dim zhanghao,mima
zhanghao=request("zhanghao")
mima=request("mima")
if zhanghao="" then
%>
<script language=javascript>
alert("帐号为空");
location.href="denglu.asp"
</script>
<% end if %>
<% if mima="" then
%>
<script language=javascript>
alert("密码为空");
location.href="denglu.asp"
</script>
<% end if %>
<%set rs=server.createobject("adodb.recordset")
rs.open "select * from student where zhanghao='"&zhanghao&"'",conn,1,3
if not rs.eof then
if mima=rs("mima") then
session("zhanghao")=zhanghao
Response.write("<script>location.href('index.asp')</script>" )
else
response.write ("<script>alert('用户密码错误');location.href('denglu.asp')</script>")
end if
end if
if rs.eof then
response.write ("<script>alert('用户帐号错误');location.href('denglu.asp')</script>")
end if
set rs=nothing
rs.close
%>
</body>
</html>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
if name="" or content="" then
Response.write "<script>location.href = "(**你要返回的页面**)";</script>"
end if
Response.write "<script>location.href = "(**你要返回的页面**)";</script>"
end if
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询