按下提交按钮后,用相同的颜色框打开一个新表单

open a new form in the same colorbox after pressing the submit button

本文关键字:表单 新表单 一个 颜色 按钮 提交      更新时间:2023-09-26

我有一个在颜色框中打开提交按钮的表单,我希望在按下提交后,一个新表单将显示在相同的颜色框中。所以我有主页

<link media="screen" rel="stylesheet" href="colorbox.css" />
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript">
</script>
<script type="text/javascript">`
$(function()
{
$('#link_content').colorbox({opacity:0.3});
});
</script>

以及我打开ragister.jsp 的部分

<a  href='ragister.jsp' id='link_content' ><h2>Register here </h2></a>

register.jsp有一个带有提交按钮的表单,按下后它会调用一个process.jsp,process.jsp会验证ragister.jsp的文本框是否正确(如果是),如果不是,则保存在数据库中。process.jsp包括另一个带有特定错误的表单(error.jsp)

所以我想要的是process.jsp和error.jsp表单显示在ragister.jsp 的同一个颜色框中

thanx!

要实现这一点,您需要在iframe中强制加载颜色框。我记得,您需要添加到.colorbox()的只是'iframe': true,但这也需要您指定确切的widthheight,因为colorbox无法知道它创建的iframe中发生了什么。