【问题标题】:How can i disable a html control in the web-browser如何在网络浏览器中禁用 html 控件
【发布时间】:2015-02-10 17:42:45
【问题描述】:
为什么我无法更改浏览器控件中HTML 元素的可见性/已启用属性。我正在使用如下代码:
webBrowser.Document.GetElementById("myCombo").SetAttribute("Visible", "False")
webBrowser.Document.GetElementById("myCombo").SetAttribute("Enabled", "False")
在这种情况下我做错了什么?
【问题讨论】:
标签:
c#
html
vb.net
winforms
webbrowser-control
【解决方案1】:
要隐藏元素,请使用:
webBrowser.Document.GetElementById("myCombo").Enabled = False
要显示一个元素,请使用:
webBrowser.Document.GetElementById("myCombo").Enabled = True
【解决方案2】:
这样做:
webBrowser.Document.GetElementById("myCombo").Enabled = False '<--- for disable the control
webBrowser.Document.GetElementById("myCombo").Enabled = True'<--- for enable the control