本文介绍了VBScript和使用文件刷新IFrame检查的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图每隔30秒刷新我的iframe,如果页面不可用,请将其切换到错误页面。我得到一个调用Sub时不能使用圆括号的错误,而且vbscript从不起作用。我已经看过其他人尝试做类似事情的几个例子,我不知道我做错了什么。
I am trying to refresh my iframe every 30 sec and have it swtich to an error page if the page is unavaiable. I get a "Cannot use parentheses when calling a Sub" error and the vbscript never works. I have looked at several examples of others trying to do similar things, and i cannot tell what i am doing wrong.
<!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>
推荐答案
<!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
Fixed it thanks Ansgar Wiechers
这篇关于VBScript和使用文件刷新IFrame检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!