我知道如何使用webbrowser控件在按钮上模拟click
事件。但是,我无法使用包含click
和mouseup
事件的usemap模拟图像上的mousedown
事件。
我该怎么办?
Bellow是与图像和usemap关联的html:
<img src="http://www.temp.com/zoom_off.gif" id="photo_zoom" style="width: 39px; height: 23px; border: 0" alt="" usemap="#btnZCMap">
<area shape="rect" coords="2,2,19,25" href="#" onmouseover="doBtn('photo_zoom','in'); return false;" onmouseout="ZM=0; doBtn('photoe_zoom','off'); return false;" onmousedown="ZM=1; doZC(-1); return false;" onmouseup="ZM=0; return false;" onclick="return false;">
答案 0 :(得分:0)
首先,您需要获取元素,然后调用正确的成员,例如:
For Each elem As HtmlElement In webBrowser1.Document.GetElementsByTagName("img")
If elem.GetAttribute("alt") = "MyImage" Then
elem.InvokeMember("click")
End If
Next
如果这不起作用,您可以尝试RaiseEvent
:
WebBrowser1.document.GetElementById("ImgID").RaiseEvent("onclick")