VBScript并刷新带有文件的IFrame Check

时间:2013-10-16 19:43:34

标签: html vbscript

我正在尝试每隔30秒刷新一次iframe,如果页面不可用,请将其切换到错误页面。我得到一个“调用Sub时不能使用括号”错误,并且vbscript永远不会工作。我看过其他几个试图做类似事情的例子,我不知道我做错了什么。

<!DOCTYPE html>
    <html>
      <head>
        <title>Census Status</title>
      </head>  
      <body>
        <iframe class="main" id="main" src="G:\CensusAlert\Default.html" width="96%" height="95%"></iframe>    
        <script type="text/vbscript">
        Function refreshGadget
        Set objFSO = CreateObject("Scripting.FileSystemObject")
            Set iFrame = document.getElementById("main")
            If objFSO.FileExists("G:\CensusAlert\Default.html") then
                iFrame.src = "G:\CensusAlert\Default.html"
            Else
                iFrame.src = "C:\Program Files\SAMCAlert\Error.html"
            End If
        End Function
        window.setInterval(refreshGadget, 30000, VBScript)
        </script>
      </body>
    </html>

1 个答案:

答案 0 :(得分:0)

<!DOCTYPE html>
    <html>
      <head>
        <title>Census Status</title>
      </head>  
      <body>
        <iframe class="main" id="main" src="G:\CensusAlert\Default.html" width="96%" height="95%"></iframe>    
        <script type="text/vbscript">
        Function refreshGadget
        Set objFSO = CreateObject("Scripting.FileSystemObject")
            Set iFrame = document.getElementById("main")
            If objFSO.FileExists("G:\CensusAlert\Default.html") then
                iFrame.src = "G:\CensusAlert\Default.html"
            Else
                iFrame.src = "C:\Program Files\SAMCAlert\Error.html"
            End If
        End Function
        window.setInterval("refreshGadget", 30000, "VBScript")
        </script>
      </body>
    </html>

修正了感谢Ansgar Wiechers