动态更改 HTA 窗口属性

发布于 2024-12-22 01:01:40 字数 474 浏览 0 评论 0原文

在我的 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 技术交流群。

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

发布评论

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

评论(1

嘿看小鸭子会跑 2024-12-29 01:01:40

您无法在运行时更改它,它只能在 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 & call cancelBubble 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.

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