vb的webbrowser中的图片点击
PrivateSubCommand5_Click()DimiAsIntegerFori=0ToWebBrowser1.Document.All.length-1OnErr...
Private Sub Command5_Click()
Dim i As Integer
For i = 0 To WebBrowser1.Document.All.length - 1
On Error Resume Next
If WebBrowser1.Document.All(i).Tag = "IMG" And WebBrowser1.Document.All(i).Index = "42" Then
WebBrowser1.Document.All(i).Click
End If
Next
End Sub
Private Sub Form_Load()
WebBrowser1.Navigate ("http://nic.dgut.edu.cn/")
End Sub
为什么这个图片链接实现不了自动点击?问题出在哪里? 展开
Dim i As Integer
For i = 0 To WebBrowser1.Document.All.length - 1
On Error Resume Next
If WebBrowser1.Document.All(i).Tag = "IMG" And WebBrowser1.Document.All(i).Index = "42" Then
WebBrowser1.Document.All(i).Click
End If
Next
End Sub
Private Sub Form_Load()
WebBrowser1.Navigate ("http://nic.dgut.edu.cn/")
End Sub
为什么这个图片链接实现不了自动点击?问题出在哪里? 展开
1个回答
展开全部
修改如下:
Private Sub Command5_Click()
Dim i As Integer
For i = 0 To WebBrowser1.Document.All.length - 1
On Error Resume Next
If WebBrowser1.Document.All(i).TagName = "IMG" And WebBrowser1.Document.All(i).Index = "42" Then '把Tag 改为TagName
WebBrowser1.Document.All(i).Click
exit for '如果不增加此行,则程序会连烂告州续点击,出现混饥蔽乱!友蔽
End If
Next
End Sub
Private Sub Form_Load()
WebBrowser1.Navigate ("http://nic.dgut.edu.cn/")
End Sub
建议:经调试,上述代码会连接点击,从而跳出无数个窗口,差点把俺电脑搞崩溃!,所以WebBrowser1.Document.All(i).Index = "42"似乎有问题,能否直接改为WebBrowser1.Document.All(i).src="XXX.gif"?请参考。
Private Sub Command5_Click()
Dim i As Integer
For i = 0 To WebBrowser1.Document.All.length - 1
On Error Resume Next
If WebBrowser1.Document.All(i).TagName = "IMG" And WebBrowser1.Document.All(i).Index = "42" Then '把Tag 改为TagName
WebBrowser1.Document.All(i).Click
exit for '如果不增加此行,则程序会连烂告州续点击,出现混饥蔽乱!友蔽
End If
Next
End Sub
Private Sub Form_Load()
WebBrowser1.Navigate ("http://nic.dgut.edu.cn/")
End Sub
建议:经调试,上述代码会连接点击,从而跳出无数个窗口,差点把俺电脑搞崩溃!,所以WebBrowser1.Document.All(i).Index = "42"似乎有问题,能否直接改为WebBrowser1.Document.All(i).src="XXX.gif"?请参考。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询