自动执行任务并每 10 分钟自动刷新一次网页

发布于 2024-12-14 11:16:24 字数 400 浏览 2 评论 0原文


请指导我如何完成以下任务。

我必须每 15 分钟监控 5 个网页。

假设网页名称为 A.html,B.html,C.html,D.html,E.html.

我正在打开每个 IE( Internet Explorer)每 15 分钟手动访问一次网页并检查是否有是向上还是向下。

我们可以使其自动化吗,我想要一个链接,如果我单击该链接,应该打开所有 5 个网页,并每 10 分钟自动刷新一次。

请向我建议任何可能的网页链接或者在这种情况下可以帮助我的网站或教程。

谢谢,
斯里哈里

Please guide me how can I achieve the below task.

I have to monitor 5 web pages every 15 minutes.

Say the webpages names are A.html,B.html,C.html,D.html,E.html.

I am opening each IE(internet explorer) web page manually every 15 minutes and checking whether it is up or down.

Can we make this automated, I want a single link on which if I click it should open all the 5 web pages and autorefresh them for every 10 minutes.

Please suggest me any possible web links or websites or tutorials that can help me in this case.

Thanks,
Srihari

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

不美如何 2024-12-21 11:16:24

试试这个:

var refreshPages = new Array("http://www.microsoft.com", "http://www.bing.com", "http://www.apple.com");
    var refreshRate = 5000; //milliseconds

    function refreshWindows() {
        for (index in refreshPages)
        {
            window.open(refreshPages[index], "refreshwindow" + index, "");
        }

        setTimeout("refreshWindows();", refreshRate);
    }

您可以通过单击按钮来调用此函数,例如:

<a href="#" onclick="refreshWindows();return false;">start monitoring</a>

如您所见,我声明了要打开的 uri 数组,并且还声明了刷新率(毫秒)。
在refreshWindows方法中,我循环遍历数组并为每个URI调用window.open方法。这里最重要的是我还为每个窗口提供了一个名称(refreshWindowINDEX)。因此,下次我使用已经使用过的名称调用 window.open-method 时,浏览器将在窗口中使用该名称打开该 uri。我调用 setTimeout 方法,以便 JavaScript 等待(在本示例中为 5 秒)并再次调用刷新 Windows 方法。在同一窗口中打开同一组 uri。

Try this:

var refreshPages = new Array("http://www.microsoft.com", "http://www.bing.com", "http://www.apple.com");
    var refreshRate = 5000; //milliseconds

    function refreshWindows() {
        for (index in refreshPages)
        {
            window.open(refreshPages[index], "refreshwindow" + index, "");
        }

        setTimeout("refreshWindows();", refreshRate);
    }

You can call this function on a button-click for example:

<a href="#" onclick="refreshWindows();return false;">start monitoring</a>

As you can see, I declate an array of uri's that I want to open and I also declare a refreshRate (Milliseconds).
In the refreshWindows-method I loop through my array and call the window.open-method for each URI. The most important thing here is that I also provide a name for each window (refreshWindowINDEX). So the next time I call the window.open-method with a name that I've already used, the browser will open that uri in the window with that name. I call the setTimeout-method, so that JavaScript waits (in this example 5 seconds) and calls the refreshWindows-method again. Opening the same set of uri's in the same windows.

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