vb 读取网页中的数据
<formaction='login.php'method='POST'><table><tr><td>Username:</td><td><inputtype='tex...
<form action='login.php' method='POST'>
<table>
<tr>
<td>
Username:
</td>
<td>
<input type='text' size='15' maxlength='25' name='username'>
</td>
</tr>
<tr>
<td>
Password:
</td>
<td>
<input type='password' size='15' maxlength='25' name='password'>
</td>
</tr>
<tr>
<td>
Security Code:
</td>
<td>
<input type='text' size='5' maxlength='5' name='code'>10112</td>
</tr>
<tr>
<td>
</td>
<td>
<input type="submit" value="Enter">
</td>
</tr>
</form>
读取<input type='text' size='5' maxlength='5' name='code'>10112</td>里面的10112,这个数是验证数字,不是图片, 展开
<table>
<tr>
<td>
Username:
</td>
<td>
<input type='text' size='15' maxlength='25' name='username'>
</td>
</tr>
<tr>
<td>
Password:
</td>
<td>
<input type='password' size='15' maxlength='25' name='password'>
</td>
</tr>
<tr>
<td>
Security Code:
</td>
<td>
<input type='text' size='5' maxlength='5' name='code'>10112</td>
</tr>
<tr>
<td>
</td>
<td>
<input type="submit" value="Enter">
</td>
</tr>
</form>
读取<input type='text' size='5' maxlength='5' name='code'>10112</td>里面的10112,这个数是验证数字,不是图片, 展开
2个回答
展开全部
窗体中加一个ms internet control,默认名为"webbroswer1"
Private Sub Form_Load()
WebBrowser1.Navigate "http://网页的地址"
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim doc
Dim tg
Set doc = WebBrowser1.Document
For i = 0 To doc.All.length - 1
If (LCase(doc.All(i).tagname)) = "input" Then
if (LCase(doc.All(i).name)) = "code" then
Set tg = doc.All(i-1)
MsgBox tg.outertext
end if
End If
Next i
End Sub
Private Sub Form_Load()
WebBrowser1.Navigate "http://网页的地址"
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim doc
Dim tg
Set doc = WebBrowser1.Document
For i = 0 To doc.All.length - 1
If (LCase(doc.All(i).tagname)) = "input" Then
if (LCase(doc.All(i).name)) = "code" then
Set tg = doc.All(i-1)
MsgBox tg.outertext
end if
End If
Next i
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询