我试图使登录窗体在iframe中打开。如果用户单击提交按钮时登录成功,我希望iframe关闭并将浏览器重定向到index.php。 问题是,我不知道如何从这一点关闭iframe。如何在成功登录时在父级关闭iframe?
下面是相关的iframe的代码,我有:
login.tmpl(HTML文件,其中的形式)
<div class="form_item submit_button">
<button type="submit" name="submit">Login</button>
</div>
login.php中(其中i重定向到指数这是哪里我想我需要一些额外的代码以关闭IFRAME)
if (!$error) {
throw new RedirectBrowserException('index.php');
}
gallery.tmpl(其中的iframe被调用。不应该是很重要的,我认为)
<a class="fancybox iframe fancybox.iframe" href="login.php">Iframe Login</a>
编辑。这里是我的jQuery代码(gallery.tmpl):
$(document).ready(function() {
$(".fancybox").fancybox({
padding : 0,
prevEffect : 'none',
nextEffect : 'none',
helpers : {
title : {
type: 'over'
},
thumbs : {
width : 50,
height : 50
}
}
});
});
$(document).ready(function() {
$("a.iframe").fancybox({
autoDimensions : false,
autoSize : false,
padding : 0,
width : 395,
height : 195,
type : 'iframe'
});
});
谢谢。第二部分工程关闭fancybox,但第一部分废弃我的iframe并在主窗口中打开登录页面。我无法找到关于这个afterClose的东西的任何信息...我也尝试在login.php重定向后关闭iframe,在这种情况下,它重定向iframe首先索引,然后关闭它。 – Chemist 2013-03-06 00:08:49