<iframe name="server" style="display:none;"></iframe> //display:none 不显示
<form method="get" name="my_form" target="server">
<input type="button" value="获取验证码" name="get_msg" onclick="check_form_2()"/>
<input type="button" value="登录" name="Login" onclick="check_form()"/>
<script>
function check_form()
{
document.my_form.action="cgi-bin/send_msg.cgi";
document.my_form.submit(); //表单数据提交cgi,页面跳转到iframe里不会跳转到cgi
return true;
}
function check_form_2()
{
document.my_form.action="cgi-bin/login.cgi";
document.my_form.target=""; //消除target属性,恢复默认跳转
document.my_form.submit();
return true;
}
</script>
HTML提交表单不跳转,另一按钮提交同一表单跳转
最新推荐文章于 2023-02-08 16:26:49 发布