如何在提交时关闭 fancybox...请需要帮助
我真的需要这个弹出框(fancybox)在用户提交表单时关闭...... 现在,2秒后它会重定向到相同的表单(signup.php),但我希望它说谢谢消息,然后关闭框......
<h1>SIGN UP</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<?php if($form_complete === FALSE): ?>
<div id="newsletter">
<!-- <div id="fancybox-close1"><a href="#" onClick="parent.jQuery.fancybox.close();"><img src="js/fancybox/fancy_close.png" /></a></div> -->
<form id="form" name="form" method="post" action="signup.php">
<label></label>
<fieldset>
<label>Name: <?php if(in_array('name', $validation)): ?><span class="error"><?php echo $error_messages['name']; ?></span><?php endif; ?><input type="text" id="name" name="name" value="<?php echo isset($_POST['name'])? $_POST['name'] : ''; ?>" onFocus="this.value=''" maxlength="255"></label>
<label>Surname: <?php if(in_array('name', $validation)): ?><span class="error"><?php echo $error_messages['surname']; ?></span><?php endif; ?><input type="text" id="surname" name="surname" value="<?php echo isset($_POST['surname'])? $_POST['surname'] : ''; ?>" onFocus="this.value=''" maxlength="255"></label>
<label>Position: <?php if(in_array('name', $validation)): ?><span class="error"><?php echo $error_messages['position']; ?></span><?php endif; ?><input type="text" id="position" name="position" value="<?php echo isset($_POST['position'])? $_POST['position'] : ''; ?>" onFocus="this.value=''" maxlength="255"></label>
<label>Organization: <?php if(in_array('name', $validation)): ?><span class="error"><?php echo $error_messages['organization']; ?></span><?php endif; ?><input type="text" id="organization" name="organization" value="<?php echo isset($_POST['organization'])? $_POST['organization'] : ''; ?>" onFocus="this.value=''" maxlength="255"></label>
<label>Email: <?php if(in_array('email', $validation)): ?><span class="error"><?php echo $error_messages['email']; ?></span><?php endif; ?><input type="text" id="email" name="email" value="<?php echo isset($_POST['email'])? $_POST['email'] : ''; ?>" onFocus="this.value=''" maxlength="255"></label>
<input type="submit" id="submit" name="submit" value="SIGN-UP">
</fieldset>
</form><!-- end sign up form -->
<?php else: ?>
<div class="thankyouMessage">Thank you for subscribing!</div>
<script type="text/javascript">
setTimeout('ourRedirect()',2000)
function ourRedirect(){
location.href='signup.php'
}
</script>
<?php endif; ?>
I really need this pop up box (fancybox) to close when a user submits the form...
Right now, it is redirecting to the same form (signup.php) after 2 seconds but I wanted it to say the thank you message then closes the box...
<h1>SIGN UP</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<?php if($form_complete === FALSE): ?>
<div id="newsletter">
<!-- <div id="fancybox-close1"><a href="#" onClick="parent.jQuery.fancybox.close();"><img src="js/fancybox/fancy_close.png" /></a></div> -->
<form id="form" name="form" method="post" action="signup.php">
<label></label>
<fieldset>
<label>Name: <?php if(in_array('name', $validation)): ?><span class="error"><?php echo $error_messages['name']; ?></span><?php endif; ?><input type="text" id="name" name="name" value="<?php echo isset($_POST['name'])? $_POST['name'] : ''; ?>" onFocus="this.value=''" maxlength="255"></label>
<label>Surname: <?php if(in_array('name', $validation)): ?><span class="error"><?php echo $error_messages['surname']; ?></span><?php endif; ?><input type="text" id="surname" name="surname" value="<?php echo isset($_POST['surname'])? $_POST['surname'] : ''; ?>" onFocus="this.value=''" maxlength="255"></label>
<label>Position: <?php if(in_array('name', $validation)): ?><span class="error"><?php echo $error_messages['position']; ?></span><?php endif; ?><input type="text" id="position" name="position" value="<?php echo isset($_POST['position'])? $_POST['position'] : ''; ?>" onFocus="this.value=''" maxlength="255"></label>
<label>Organization: <?php if(in_array('name', $validation)): ?><span class="error"><?php echo $error_messages['organization']; ?></span><?php endif; ?><input type="text" id="organization" name="organization" value="<?php echo isset($_POST['organization'])? $_POST['organization'] : ''; ?>" onFocus="this.value=''" maxlength="255"></label>
<label>Email: <?php if(in_array('email', $validation)): ?><span class="error"><?php echo $error_messages['email']; ?></span><?php endif; ?><input type="text" id="email" name="email" value="<?php echo isset($_POST['email'])? $_POST['email'] : ''; ?>" onFocus="this.value=''" maxlength="255"></label>
<input type="submit" id="submit" name="submit" value="SIGN-UP">
</fieldset>
</form><!-- end sign up form -->
<?php else: ?>
<div class="thankyouMessage">Thank you for subscribing!</div>
<script type="text/javascript">
setTimeout('ourRedirect()',2000)
function ourRedirect(){
location.href='signup.php'
}
</script>
<?php endif; ?>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用:
您可以在弹出框中
来关闭 fancybox。 (如果这没有关闭弹出窗口,请在弹出窗口中包含 jquery 和 fancybox 库)
you can use:
in the pop up box to close fancybox.
(if this don't close the pop up include jquery and fancybox libraries in the pop up)