慵懒公主变身妖魅王子:那个知道javascript(vbscript)编写一个代码
来源:百度文库 编辑:中科新闻网 时间:2024/05/13 00:37:58
<body bgcolor="#00ffff">
<form action="xiaoai4.htm"" method="post">
<p align="center">姓名:<input nema="user" type="text" size="19" maxlength="20" ></p>
<p align="center">密码:<input type="Password" name="pass" size="20" maxlength="20" ></p>
<p align="center"><input type="reset" value="退出"><input type="Submit" value=" 登陆 ">
<pre>
<br>
</pre>
</form>
</pre>
</body>你们也可以加我QQ号码.我的号码是:17664529
<%
If Lcase(Request("action"))="login" Then
user=Replace(request("user"),"'","")
password = Replace(request("password"),"'","")
if user="myname" and password = "mypassword" then //这里设置用户名和密码
Response.Write("<script>alert('登陆成功!');window.location='这里写登陆成功后的页面';</script>")
else
Response.Write("<script>alert('登陆失败,用户名或密码错误!');window.location='xiaoai4.asp';</script>")
Response.End
End if
End if
%>
<body bgcolor="#00ffff">
<form action="xiaoai4.asp?action=login"" method="post">
<p align="center">姓名:<input nema="user" type="text" size="19" maxlength="20" ></p>
<p align="center">密码:<input type="Password" name="pass" size="20" maxlength="20" ></p>
<p align="center"><input type="reset" value="退出"><input type="Submit" value=" 登陆 ">
<pre>
<br>
</pre>
</form>
</pre>
</body>
==========================
上面的代码保存为:xiaoai4.asp
另,该例中就没有使用数据库了。
有什么问题联系qq:645988432
<head>
<title>本文件名是xiaoai4.htm<title>
</head>
<body bgcolor="#00fff">
<%
if trim(request.form("user"))="123456" and trim(request.form("pass"))="123456" then
response.redirect "index.asp"
end if
%>
</body>
另外,你姓名那里:<input name="user">,不是nema
<script language="javascript">
<!--
function yanzheng()
{
if (document.form1.user.value=="123456"){
if (document.form1.pass.value=="123456")
{
window.location.href="xiaoai4.htm";
}}
else
alert("户名验证错误!");
}
//-->
</script>
</head>
<body bgcolor="#00ffff">
<form action="xiaoai4.htm" method="post" name="form1">
<p align="center">姓名:<input name="user" type="text" id="user" size="19" maxlength="20">
</p>
<p align="center">密码:<input type="Password" name="pass" size="20"id="pass" maxlength="20" ></p>
<p align="center"><input name="按钮" type="button" onclick="window.opener=null;window.close()" value="退出">
<input name="按钮" type="button" onclick="javascript:yanzheng()" value=" 登陆 ">
</form>
</body>
这种验证方法没有安全性可言,虽然可以实现验证