VB如何读取网页代码中的内容

来源:百度知道 编辑:UC知道 时间:2024/05/11 17:39:26
比如某个网页代码种有个这个代码
<a href=http://baidu.com>123456<a>

用VB怎样能读出那个“123456”的内容?

请高手指点

Dim x As Long,S as string
For x = 0 To WebBrowser1.Document.links.length - 1
s=WebBrowser1.Document.links.Item(x)
if lcase(s)="http://baidu.com" then
msgbox "你要查找的内容是:" & WebBrowser1.Document.links.Item(x).innerText
exit for
endif
Next x

Private Sub Command1_Click()
Dim xx As String, yy As String, url As String
Dim t As Double
url = "http:www.baidu.com"
Inet1.Cancel
Inet1.Execute url, "get"
t = Timer
Do
DoEvents
If Inet1.StillExecuting = False Or Abs(t - Timer) > 20 Then Exit Do
Loop
xx = ""
Do
DoEvents
yy = Inet1.GetChunk(32768)
If yy = "" Or Abs(t - Timer) > 20 Then Exit Do
xx = xx & Uf8ToUf(yy)
Ric