注册 登录
编程论坛 ASP技术论坛

我在做一个登陆系统 有一点小问题!

keybord 发布于 2010-01-07 11:44, 453 次点击
我想让别人登陆时,如果是密码或帐号出错马上就在当前页面弹出个消息框提示!我的验证代码和登陆页面做在一起的!本人是新手自学,找不到人请教 天资愚钝
2 回复
#2
yms1232010-01-07 15:51
<html>
<head>
   <title>登陆提示</title>
<script language="javascript">
function Page_Load()
{
<%
    Dim UsName,Pwd
    UsName=Request.Form("userName")
    Pwd=Request.Form(Pwd)
    IF Request.Form("IsSubmit")="True" Then
       IF UsName<>"abc" And Pwd<>"123" Then
          Response.Write "alert('用户名不是abc,密码不是123');"
       Else
          Response.Write "alert('登陆成功');"
       End IF
    End IF
%>
}
//表单提交方法
function form1_Sbumit()
{
   //判断用户名密码是否为空
   if(document.form1.userName.value=="")
   {
       alert('用户名不能为空');
       return false;
   }
   if(document.form1.passWord.value=="")
   {
       alert('密码不能为空');
       return false;
   }
   document.form1.action=self.location.href;//获得当前页的URL
   document.form1.submit();//提交表单
}
</script>
</head>
<body onLoad="Page_Load();">
<form name="form1" method="post" target="_self">
  <input type="text" name="userName"> 用户名<br>
  <input type="password" name="passWord">密码<br>
  <!--判断表单是否提交-->
  <input type="hidden" name="IsSubmit" value="True" >
  <input type="button" onClick="form1_Submit();" name="Submit" value="登陆">
</form>
</body>
</html>
#3
keybord2010-01-10 11:54

谢谢啊 !缘分啊
1