vb怎么提取网页中的链接? 100
2个回答
展开全部
Private Sub Command1_Click()
Dim vTag, vDoc
Dim AllCount, i
List1.Clear
Set vDoc = WebBrowser1.Document.All
AllCount = vDoc.Length
MsgBox (AllCount)
For i = 0 To AllCount - 1
Debug.Print vDoc.Item(i)
If UCase(vDoc.Item(i).TagName) = "A" Then '?òμ?URL
vTag = vDoc.Item(i).href
If InStr(vTag, "http://dhunter.51.net") Then '?ì2aURL?Dê?·?o?óD[url]http://dhunter.51.net[/url]
List1.AddItem vDoc.Item(i).href 'è?1?óD?òìí?óμ?list1?D
End If
End If
Next i
End Sub
Private Sub Form_Load()
WebBrowser1.Navigate "www.baidu.com"
End Sub
Dim vTag, vDoc
Dim AllCount, i
List1.Clear
Set vDoc = WebBrowser1.Document.All
AllCount = vDoc.Length
MsgBox (AllCount)
For i = 0 To AllCount - 1
Debug.Print vDoc.Item(i)
If UCase(vDoc.Item(i).TagName) = "A" Then '?òμ?URL
vTag = vDoc.Item(i).href
If InStr(vTag, "http://dhunter.51.net") Then '?ì2aURL?Dê?·?o?óD[url]http://dhunter.51.net[/url]
List1.AddItem vDoc.Item(i).href 'è?1?óD?òìí?óμ?list1?D
End If
End If
Next i
End Sub
Private Sub Form_Load()
WebBrowser1.Navigate "www.baidu.com"
End Sub
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询