douhuang2218 2014-02-06 18:51
浏览 31

单击“提交”时打开JS弹出窗口

I have a contact form on my web site included where visitors have to fill in their name, address and email and now I try to add a content locker (javascript) which shall appear once they click on the "submit" button. The "onclick" works but the site automatically moves forward to the "submit.php" site and closes the content locker in seconds. I also want to have the visitors data already saved in case they close the site without paying attention to the PopUp. Is this possible?

Regards

  • 写回答

2条回答 默认 最新

  • douqiao3930 2014-02-06 18:55
    关注

    Have you tried delaying the submission?

    <script type="text/javascript">
            $(document).ready(function() {
                $('#myform').submit(function(e) {
                    e.preventDefault();
    
                    setTimeout(function () {
                        form.submit();
                    }, 3000); // in milliseconds
                });
            });
        </script>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教