asp后台登陆没反应,先跳到后台页,然后马上跳回登陆界面了!求助!
<bodybackground="Images/login_bg.gif"><tablewidth="100%"border="0"cellspacing="0"cell...
<body background="Images/login_bg.gif">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="600" valign="middle">
<table width="450" border="0" align="center" cellpadding="0" cellspacing="0" >
<form action="index.asp" method="post" name="form1" id="form1" onSubmit="return check()">
<tr>
<td height="332" align="center" valign="top" background="Images/login1.gif"><table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="110"> </td>
</tr>
<tr>
<td height="35"><table width="75%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="6"></td>
<td align="left"></td>
</tr>
<tr>
<td width="30%" height="35"><font style="letter-spacing:5px">帐号:</font></td>
<td align="left"><input name="user" type="text" id="user" size="30" style="width:180px; height:20px"/></td>
</tr>
</table></td>
</tr>
<tr>
<td height="35"><table width="75%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="30%" height="35"><font style="letter-spacing:5px">密码:</font></td>
<td align="left"><input name="psw" type="password" id="psw" size="30" style="width:180px; height:20px"/></td>
</tr>
</table></td>
</tr>
<tr>
<td height="35"><table width="75%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="30%" height="35"><font style="letter-spacing:5px">验证码:</font></td>
<td align="left"><input type="text" name="verifycode" size="10" value="<%If GetCode=9999 Then Response.Write "9999" end if%>" onBlur="checkcode()"/> <img src="../inc/getcode.asp"/> </td>
</tr>
</table></td>
</tr>
<tr>
<td height="6"></td>
</tr>
<tr>
<td height="40"><table width="75%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="50%" height="40" align="center"><font style="letter-spacing:5px">
<label>
<input type="submit" name="button" id="button" value="登录"/>
</label>
</font></td>
<td height="40" align="center"><font style="letter-spacing:5px">
<input type="reset" name="button2" id="button2" value="重置" />
</font></td>
</tr>
</table></td>
</tr>
</table></td>
</tr></form>
</table>
</td></tr></table>
</body>
</html>
<script language="javascript">
function check()
{
if(form1.user.value==""){
alert("用户名不能为空")
return false;
}
if(form1.psw.value==""){
alert("密码不能为空")
return false;
}
if(form1.verifycode.value==""){
alert("验证码不能为空")
return false;
}
}
</script> 展开
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="600" valign="middle">
<table width="450" border="0" align="center" cellpadding="0" cellspacing="0" >
<form action="index.asp" method="post" name="form1" id="form1" onSubmit="return check()">
<tr>
<td height="332" align="center" valign="top" background="Images/login1.gif"><table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="110"> </td>
</tr>
<tr>
<td height="35"><table width="75%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="6"></td>
<td align="left"></td>
</tr>
<tr>
<td width="30%" height="35"><font style="letter-spacing:5px">帐号:</font></td>
<td align="left"><input name="user" type="text" id="user" size="30" style="width:180px; height:20px"/></td>
</tr>
</table></td>
</tr>
<tr>
<td height="35"><table width="75%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="30%" height="35"><font style="letter-spacing:5px">密码:</font></td>
<td align="left"><input name="psw" type="password" id="psw" size="30" style="width:180px; height:20px"/></td>
</tr>
</table></td>
</tr>
<tr>
<td height="35"><table width="75%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="30%" height="35"><font style="letter-spacing:5px">验证码:</font></td>
<td align="left"><input type="text" name="verifycode" size="10" value="<%If GetCode=9999 Then Response.Write "9999" end if%>" onBlur="checkcode()"/> <img src="../inc/getcode.asp"/> </td>
</tr>
</table></td>
</tr>
<tr>
<td height="6"></td>
</tr>
<tr>
<td height="40"><table width="75%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="50%" height="40" align="center"><font style="letter-spacing:5px">
<label>
<input type="submit" name="button" id="button" value="登录"/>
</label>
</font></td>
<td height="40" align="center"><font style="letter-spacing:5px">
<input type="reset" name="button2" id="button2" value="重置" />
</font></td>
</tr>
</table></td>
</tr>
</table></td>
</tr></form>
</table>
</td></tr></table>
</body>
</html>
<script language="javascript">
function check()
{
if(form1.user.value==""){
alert("用户名不能为空")
return false;
}
if(form1.psw.value==""){
alert("密码不能为空")
return false;
}
if(form1.verifycode.value==""){
alert("验证码不能为空")
return false;
}
}
</script> 展开
1个回答
展开全部
我看你的代码 应该没用 cookie 或者 session , 应该是 如果直接登录后台就转跳到 登陆页吧,
这样的话 肯定是 登陆成功 就转跳回 登陆页 了 , 在后台加个 cookie 或者session 验证 就好了
这样的话 肯定是 登陆成功 就转跳回 登陆页 了 , 在后台加个 cookie 或者session 验证 就好了
追问
谢谢哟~ 请问怎么加session,我是新手,谢谢耶~
追答
javascript 是不能设置session的
cookie 参考http://www.php100.com/html/webkaifa/javascript/2012/0405/10197.html
另外 建议不要用javascript设置cookie 最好用服务器端脚本 如 vbscript
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询