Private Sub GetLinks() Dim pDoc3 As IHTMLDocument3 Set pDoc3 = Web.Document Dim pElemColl As IHTMLElementCollection Set pElemColl = pDoc3.getElementsByTagName("A") For i = 0 To pElemColl.length - 1 Dim pELem As IHTMLElement Set pELem = pElemColl.Item(i, i) '增加到LIST中 List1.AddItem pELem.getAttribute("HREF") Next i End Sub
a=inet1.openurl b=split(a,"href=") for i=lbound(b) to ubound(b) c=split(b(i)," ") url=replace(c(lbound(c)),"""") replace(url,"'") next http://bbs.eice.com.cn/blog/user1/3/index.html
Dim A For Each A In WebBrowser.Document.All If UCase(A.tagName) = "A" Then sql = "insert into spidedata (link,title) values ('" & A.href & "','" & A.innerText & "')" conn.Execute sql DoEvents Text1.Text = Text1.Text + 1 End If Next
Dim pDoc3 As IHTMLDocument3
Set pDoc3 = Web.Document
Dim pElemColl As IHTMLElementCollection
Set pElemColl = pDoc3.getElementsByTagName("A")
For i = 0 To pElemColl.length - 1
Dim pELem As IHTMLElement
Set pELem = pElemColl.Item(i, i)
'增加到LIST中
List1.AddItem pELem.getAttribute("HREF")
Next i
End Sub
b=split(a,"href=")
for i=lbound(b) to ubound(b)
c=split(b(i)," ")
url=replace(c(lbound(c)),"""")
replace(url,"'")
next
http://bbs.eice.com.cn/blog/user1/3/index.html
sql = "insert into spidedata (link,title) values ('" & A.href & "','" & A.innerText & "')"
conn.Execute sql
DoEvents
Text1.Text = Text1.Text + 1
End If
Next