JavaScript在30秒后提交页面

JavaScript在30秒后提交页面

本文介绍了JavaScript在30秒后提交页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种JavaScript,以在页面加载后30秒后提交页面. jQuery是否提供此功能,或者有人为此使用常规的javascript?谢谢

I am looking for a JavaScript to submit a page after 30 seconds from when the page is loaded. Does jQuery offer this functionality or does someone have regular javascript for this? Thank You

推荐答案

使用setTimeout,您可以通过具有可以为您提交表单的回调函数来实现此目的(我想这就是您说的提交页面" ')

Using setTimeout you can achieve this by having a callback function which can submit a form for you (I presume that is what you mean by saying to 'submit a page')

    <script>
    setTimeout(function() {
        document.myform.submit();
    }, 30000);
    </script>

页面加载30秒后,将提交名称为"myform"的表单.

That will submit the form with the name 'myform' after 30 seconds the page has been loaded.

这篇关于JavaScript在30秒后提交页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 22:41