1个form,2个action
今天工作上正好用到.伪单点登录….只是把同一个表单发到不同的页面而已
先写2个函数,用来将action的url分开
<Script Language="JavaScript">
function aa1()
{
document.form1.action="login.jsp"; //这是第一个
document.form1.submit();
}
function aa2()
{
document.form1.action="chklogin.jsp";//这是第二个
document.form1.username.value=form1.userid.value //name不同,所以要把另外一个里面的value搞过来
document.form1.password.value=form1.userpassword.value //密码也是一样要搞过来
document.form1.submit();
}
</Script>
function aa1()
{
document.form1.action="login.jsp"; //这是第一个
document.form1.submit();
}
function aa2()
{
document.form1.action="chklogin.jsp";//这是第二个
document.form1.username.value=form1.userid.value //name不同,所以要把另外一个里面的value搞过来
document.form1.password.value=form1.userpassword.value //密码也是一样要搞过来
document.form1.submit();
}
</Script>
[/code]表单如下:
<form name="form1" method="post" >
<input name="userid" type="text" size="17" style='width:120px;hengit:20;'>
<input name="username" type="hidden" size="17" style='width:120px;hengit:20;' >
<input name="userpassword" type="password" size="17" class='edit_css' style='width:120px;hengit:20;'>
<input name="password" type="hidden" size="17" style='width:120px;hengit:20;' >
<input name='aa' type='button' value="提交1" onClick="aa1()">
<input name='bb' type='button' value="提交2" onClick='aa2() '>
<input name="userid" type="text" size="17" style='width:120px;hengit:20;'>
<input name="username" type="hidden" size="17" style='width:120px;hengit:20;' >
<input name="userpassword" type="password" size="17" class='edit_css' style='width:120px;hengit:20;'>
<input name="password" type="hidden" size="17" style='width:120px;hengit:20;' >
<input name='aa' type='button' value="提交1" onClick="aa1()">
<input name='bb' type='button' value="提交2" onClick='aa2() '>
因为自己没本事做连接的这个窗口,就把你的借走了。..
谢谢!!!如果不能用的话,去给我捎个口信,谢谢~~ [yes]
我的地址:http://www.ooabu.com
另外,请不要连接,谢谢..不喜欢被打扰,谢谢!!再次谢谢!!
[Reply]