当用户提交表单时,我真的需要这个弹出框(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; ?>
答案 0 :(得分:3)
你可以使用:
<script type="text/javascript">
parent.$.fancybox.close();
</script>
在弹出框中关闭fancybox。
(如果没有关闭弹出窗口,请在弹出窗口中包含jquery和fancybox库)