上次分太少,这个帖子主要是给二位加分。跟贴吧。怎么编程把用户名,密码提交到网页上的登录页?
首先在程序中加入Webbrowser控件并加入引用 Microsoft HTML Object Library。
假设你的HTML页面表单代码如下:
<form method= "POST " action= "http://chen/dll/chat/chatmain.exe/RegUser " >
<p >请填写下面表单注册(*项为必添项) </p >
<p >*姓名 <input type= "text " name= "Name " size= "20 " > </p >
<p >*昵称 <input type= "text " name= "NickName " size= "20 " > </p >
<p >电子邮件 <input type= "text " name= "EMail " size= "20 " > </p >
<p >*密码 <input type= "text " name= "Password " size= "20 " > </p >
<p > <input type= "submit " value= "提交 " name= "B1 " > <input type= "reset " value= "全部重写 " name= "B2 " > </p >
</form >
注意其中元素的type、Name、value属性。然后VB中的代码如下:
Private Sub Command1_Click()
WebBrowser1.Navigate "http://chen/chat/newuser.htm "
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim vDoc, vTag
Dim i As Integer
Set vDoc = WebBrowser1.Document
List1.Clear
For i = 0 To vDoc.All.length - 1
If UCase(vDoc.All(i).tagName) = "INPUT " Then
Set vTag = vDoc.All(i)
If vTag.Type = "text " Or vTag.Type = "password " Then
List1.AddItem vTag.Name
Select Case vTag.Name
Case "Name "
vTag.Value = "IMGod "
Case "NickName "
vTag.Value = "IMGod "
Case "Password "
vTag.Value = "IMGodpass "
Case "EMail "
vTag.Value = "[email protected] "
End Select
ElseIf vTag.Type = "submit " Then
vTag.Click
End If
End If
Next i
End Sub
点击Command1就可以自动填表并提交了。
在这个基础上加上一个定时器,每间隔一定时间自动点击command1.
首先在程序中加入Webbrowser控件并加入引用 Microsoft HTML Object Library。
假设你的HTML页面表单代码如下:
<form method= "POST " action= "http://chen/dll/chat/chatmain.exe/RegUser " >
<p >请填写下面表单注册(*项为必添项) </p >
<p >*姓名 <input type= "text " name= "Name " size= "20 " > </p >
<p >*昵称 <input type= "text " name= "NickName " size= "20 " > </p >
<p >电子邮件 <input type= "text " name= "EMail " size= "20 " > </p >
<p >*密码 <input type= "text " name= "Password " size= "20 " > </p >
<p > <input type= "submit " value= "提交 " name= "B1 " > <input type= "reset " value= "全部重写 " name= "B2 " > </p >
</form >
注意其中元素的type、Name、value属性。然后VB中的代码如下:
Private Sub Command1_Click()
WebBrowser1.Navigate "http://chen/chat/newuser.htm "
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim vDoc, vTag
Dim i As Integer
Set vDoc = WebBrowser1.Document
List1.Clear
For i = 0 To vDoc.All.length - 1
If UCase(vDoc.All(i).tagName) = "INPUT " Then
Set vTag = vDoc.All(i)
If vTag.Type = "text " Or vTag.Type = "password " Then
List1.AddItem vTag.Name
Select Case vTag.Name
Case "Name "
vTag.Value = "IMGod "
Case "NickName "
vTag.Value = "IMGod "
Case "Password "
vTag.Value = "IMGodpass "
Case "EMail "
vTag.Value = "[email protected] "
End Select
ElseIf vTag.Type = "submit " Then
vTag.Click
End If
End If
Next i
End Sub
点击Command1就可以自动填表并提交了。
在这个基础上加上一个定时器,每间隔一定时间自动点击command1.
我是昨天才刚到网络版溜达的