动态更改 HTA 窗口属性
在我的 HTA 中,如果发生错误,我将其保持打开状态,如果一切成功则将其关闭。一开始,我将 sysmenu
属性设置为 no
,因为我不希望用户在完成之前关闭 HTA。最后,我希望他们能够单击关闭按钮。这是我尝试实现此目的而输入的内容,但它似乎不起作用?我怀疑我需要做一些事情才能让 HTA 刷新它的 Windows 属性?
请注意,任何完全重新加载窗口和/或使脚本再次执行的解决方案都是不可接受的
If Not bHoldOpen Then
Call window.close
Else
Dim tagHTA
Set tagHTA = document.getElementsByTagName("hta:application").item(0)
Call tagHTA.setAttribute("sysmenu","yes")
End If
In my HTA, I hold it it open if an error occurred, and close it if everything was successful. At the start, I have the sysmenu
property set to no
because I do not want the user to close the HTA until it's finished. At the end, I want them to be able to click on the close button. Here's what I typed up to try to achieve this, but it doesn't seem to work? I suspect there is something I need to do to get the HTA to refresh it's windows properties?
Please note that any solution that completely reloads the window and/or makes the script execute again is not acceptable
If Not bHoldOpen Then
Call window.close
Else
Dim tagHTA
Set tagHTA = document.getElementsByTagName("hta:application").item(0)
Call tagHTA.setAttribute("sysmenu","yes")
End If
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无法在运行时更改它,它只能在
HTA:
块中使用,因为它的值用于确定物理窗口的初始创建方式。我认为您可以使用
onBeforeUnload
事件 & 生成警告。调用cancelBubble来中止关闭,但我在IE8中尝试过,但似乎仍然有问题; http://support.microsoft.com/kb/946214。如果您在流程完成后取消隐藏“关闭”按钮,那么用户可能会更简单、更容易理解。
You cannot change it at runtime, its only available in the
HTA:
block as its value is used to determine how the physical window is to be initially created.I thought you could produce a warning using the
onBeforeUnload
event & callcancelBubble
to abort the close, but I tried it in IE8 and it still seems bugged; http://support.microsoft.com/kb/946214.It would probably be simpler and easier for the user to comprehend if you were yo just unhide a "Close" button when the process completed.