如何在提交时关闭 fancybox...请需要帮助

发布于 2025-01-05 06:32:16 字数 3010 浏览 1 评论 0原文

我真的需要这个弹出框(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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

辞慾 2025-01-12 06:32:16

使用:

<script type="text/javascript">
    parent.$.fancybox.close();
</script>

您可以在弹出框中

来关闭 fancybox。 (如果这没有关闭弹出窗口,请在弹出窗口中包含 jquery 和 fancybox 库)

you can use:

<script type="text/javascript">
    parent.$.fancybox.close();
</script>

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)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文