孩子为什么不爱上学:如何实现两种登陆方式(ASP)

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/07 09:04:38
在网页中要提供两种方式的登陆模式,哪位高人指点下.

<form action="/User/Login.asp" method="post" name="Form1" onSubmit="return chk(this)">
<input name="statu" type="hidden" value="0">
<script language="javascript">
function setValue(e) {
Form1.statu.value = e;
document.all("Login1").style.display = (e==1) ? "none" : "";
document.all("Login2").style.display = (e==1) ? "" : "none";
//document.all("RegUrl").innerHTML = (e==1) ? '<a href="/Company/reg.asp" target="_blank"><font color="#FF0000">注册企业会员</font></a>' : '<a href="/User/reg.asp" target="_blank">我要注册</a>';
}
function chk(e) {
var N = Form1.statu.value;
if(N==0) {
if(e.User.value == "") {
alert("请输入用户名!");
return false;
}
if(e.Pass.value == "") {
alert("请输入密码!");
return false;
}
document.Form1.action = "/User/Login.asp";
} else {
if(e.LoginName.value == "") {
alert("请输入用户名!");
return false;
}
if(e.Pass2.value == "") {
alert("请输入密码!");
return false;
}
document.Form1.action = "/Company/Login.asp";
}
return true;
}
</script>
<tr>
<td height="8"></td>
</tr>
<tr>
<td width="153" height="70" align="center" valign="middle">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" id="Login1">
<tr>
<td width="36%" height="24" align="right" >用户名:</td>
<td width="64%" height="24" align="left"><input name="User" type="text" id="User" size="16" style="border:1px solid #666666;height:16px;width:100px;"></td>
</tr>
<tr>
<td height="24" align="right" >密   码:</td>
<td height="24" align="left"><input name="Pass" type="password" id="Pass" size="16" style="border:1px solid #666666;height:16px;width:100px;"></td>
</tr>
</table>
<table width="98%" border="0" align="center" cellspacing="0" cellpadding="0" id="Login2" style="display:none;">
<tr>
<td width="42%" height="24" align="right">用户名:</td>
<td width="58%" height="24" align="left"><input name="LoginName" type="text" id="User2" size="16" style="border:1px solid #666666;height:16px;width:80px;"></td>
</tr>
<tr>
<td height="24" align="right">密   码:</td>
<td height="24" align="left"><input name="Pass2" type="password" id="Pass2" size="16" style="border:1px solid #666666;height:16px;width:80px;"></td>
</tr>
</table></td>
</tr>
<tr>
<td height="74" align="center" valign="middle">
<table width="100%" height="83" border="0" cellpadding="0" cellspacing="0">
<tr align="left">
<td width="13%" height="20" align="right">
<input name="Type" type="radio" value="0" checked onClick="setValue(this.value)" id="Type1"> </td>
<td width="35%" height="20" align="left"><u>
<label for="Type1"><span class="STYLE1">个人会员</span></label>
</u></td>
<td height="20" align="right"><a href="/User/reg.asp"><img src="images/reg_person.gif" width="67" height="14" border="0" /></a>  </td>
</tr>
<tr align="left">
<td height="20" align="right">
<input type="radio" name="Type" value="1" onClick="setValue(this.value)" id="Type2"> </td>
<td height="20" align="left"><u>
<label for="Type2"><span class="STYLE1">企业会员</span></label>
</u></td>
<td height="20" align="right"><a href="/Company/reg.asp"><img src="images/reg_company.gif" width="47" height="14" border="0" /></a>  </td>
</tr>
<tr align="left">
<td height="35" colspan="2" align="center">
<input name="image" type="image" class="STYLE1" src="/images/login_sumbit.jpg" width="57" height="19" /> </td>
<td height="35" align="center" valign="middle"><a href="/wjmm.asp"><img src="images/login_pass.jpg" width="57" height="19" border="0" class="STYLE1" /></a></td>
</tr>
</table></td>
</tr>
<tr>
<td height="17" align="center" valign="top"> </td>
</tr>
</form>

呵呵,是POST和GET两种方式,
不过,为了安全性你应该选择POST模式

你是想验证不同的用户名和密码吗??比如说,我有昵称和ID两个不同的参数,我既可以用昵称登陆,也可以用ID登陆。如果是的话,你可以在登陆的表单里加一个下拉菜单选项。然后在验证程序中获取这个参数判断用户选择哪个方式登陆

你想完成哪两种啊老大

说的不清楚.

cookies 和 session?不知道你想问的是什么