我创建了一个 WebBrowser winform 应用程序和其顶部的菜单栏。 我想使用 winform 菜单条中 html 查看器(WebBrowser)内的 javascript 按钮
这是我的网络应用程序菜单
<a href="javascript:findPatient('ID');" class="navitem">Patient ID</a>
如何为此 href="javascript:findPatient('ID');"创建点击事件 有时我还需要 onclick 它位于我的网络应用程序中
<input type='checkbox' name='cb_top' onclick='toggleFrame(1)' checked />
如何为此创建一个点击事件, 请帮助我,谢谢
最佳答案
这是方法论,您似乎是一个足够好的编码员,可以根据您的情况调整它:
Private Function ClickSubmitButton()
Dim theButton As HtmlElement
Try
' Link the ID from the web form to the Button var
theButton = webbrowser1.Document.GetElementById("loginbutton")
' Now do the actual click.
theButton.InvokeMember("click")
Return True
Catch ex As Exception
Return False
End Try
End Function
关于javascript - win 表单 web 浏览器菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9985915/