Option Explicit Private WithEvents ctl00_ContentPlaceHolder1_DropDownList城市 As HTMLSelectElement Private WithEvents ctl00_ContentPlaceHolder1_DropDownList区域 As HTMLSelectElement Private WithEvents ctl00_ContentPlaceHolder1_DropDownList片区 As HTMLSelectElementPrivate Sub ctl00_ContentPlaceHolder1_DropDownList城市_onchange() ctl00_ContentPlaceHolder1_DropDownList区域.Value = "青秀区" ctl00_ContentPlaceHolder1_DropDownList区域.FireEvent "onchange" End SubPrivate Sub ctl00_ContentPlaceHolder1_DropDownList区域_onchange() ctl00_ContentPlaceHolder1_DropDownList片区.Value = "柳沙" ctl00_ContentPlaceHolder1_DropDownList片区.FireEvent "onchange" End SubPrivate Sub ctl00_ContentPlaceHolder1_DropDownList片区_onchange() '提交 End SubPrivate Sub Form_Load() WebBrowser1.Navigate2 "http://house.gxsky.com/intermediary/ChuShou.aspx?type=n" End SubPrivate Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant) Dim oDoc As HTMLDocument Set oDoc = pDisp.Document
With oDoc Set ctl00_ContentPlaceHolder1_DropDownList城市 = .getElementById("ctl00_ContentPlaceHolder1_DropDownList城市") Set ctl00_ContentPlaceHolder1_DropDownList区域 = .getElementById("ctl00_ContentPlaceHolder1_DropDownList区域") Set ctl00_ContentPlaceHolder1_DropDownList片区 = .getElementById("ctl00_ContentPlaceHolder1_DropDownList片区")
ctl00_ContentPlaceHolder1_DropDownList城市.Value = "南宁市" ctl00_ContentPlaceHolder1_DropDownList城市.FireEvent "onchange" End With
End Sub
添加引用 Microsoft HTML Object Library 就可以了
ctl00_ContentPlaceHolder1_DropDownList城市.Value = "南宁市" ctl00_ContentPlaceHolder1_DropDownList城市.FireEvent "onchange" End With 拷贝这么多 我要分啊 没分下载
Option Explicit Private WithEvents dpl城市 As HTMLSelectElement Private WithEvents dpl区域 As HTMLSelectElement Private WithEvents dpl片区 As HTMLSelectElementPrivate Sub dpl城市_onchange() SelectByDisplayText dpl区域, "良庆区" End SubPrivate Sub dpl区域_onchange() SelectByDisplayText dpl片区, "五象新区" End SubPrivate Sub dpl片区_onchange() '提交 End SubPrivate Sub Form_Load() WebBrowser1.Navigate2 "http://www.nn-sky.com" End SubPrivate Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant) '一天一个梦 '000000
If LCase(URL) <> "http://www.nn-sky.com/user/house_fabu.asp" Then Exit Sub Dim oDoc As HTMLDocument Set oDoc = pDisp.Document
With oDoc Set dpl城市 = .getElementById("city_one") Set dpl区域 = .getElementById("city_two") Set dpl片区 = .getElementById("city_three")
If dpl城市 Is Nothing Then Exit Sub If dpl区域 Is Nothing Then Exit Sub If dpl片区 Is Nothing Then Exit Sub
SelectByDisplayText dpl城市, "南宁市" End With
End Sub Private Sub SelectByDisplayText(dpl As HTMLSelectElement, ByVal sSelectText As String) Dim opt As HTMLOptionElement
For Each opt In dpl.Options If opt.Text = sSelectText Then opt.Selected = True dpl.FireEvent "onchange" Exit Sub End If Next End Sub
Option Explicit Private WithEvents dpl城市 As HTMLSelectElement Private WithEvents dpl区域 As HTMLSelectElement Private WithEvents dpl片区 As HTMLSelectElementPrivate Sub dpl城市_onchange() SelectByDisplayText dpl区域, "良庆区" End SubPrivate Sub dpl区域_onchange() SelectByDisplayText dpl片区, "五象新区" End SubPrivate Sub dpl片区_onchange() '提交 End SubPrivate Sub Form_Load() WebBrowser1.Navigate2 "http://www.nn-sky.com" End SubPrivate Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant) '一天一个梦 '000000
If LCase(URL) <> "http://www.nn-sky.com/user/house_fabu.asp" Then Exit Sub Dim oDoc As HTMLDocument Set oDoc = pDisp.Document
With oDoc Set dpl城市 = .getElementById("city_one") Set dpl区域 = .getElementById("city_two") Set dpl片区 = .getElementById("city_three")
If dpl城市 Is Nothing Then Exit Sub If dpl区域 Is Nothing Then Exit Sub If dpl片区 Is Nothing Then Exit Sub
SelectByDisplayText dpl城市, "南宁市" End With
End Sub Private Sub SelectByDisplayText(dpl As HTMLSelectElement, ByVal sSelectText As String) Dim opt As HTMLOptionElement
For Each opt In dpl.Options If opt.Text = sSelectText Then opt.Selected = True dpl.FireEvent "onchange" Exit Sub End If Next End Sub
Option Explicit
Private WithEvents ctl00_ContentPlaceHolder1_DropDownList城市 As HTMLSelectElement
Private WithEvents ctl00_ContentPlaceHolder1_DropDownList区域 As HTMLSelectElement
Private WithEvents ctl00_ContentPlaceHolder1_DropDownList片区 As HTMLSelectElementPrivate Sub ctl00_ContentPlaceHolder1_DropDownList城市_onchange()
ctl00_ContentPlaceHolder1_DropDownList区域.Value = "青秀区"
ctl00_ContentPlaceHolder1_DropDownList区域.FireEvent "onchange"
End SubPrivate Sub ctl00_ContentPlaceHolder1_DropDownList区域_onchange()
ctl00_ContentPlaceHolder1_DropDownList片区.Value = "柳沙"
ctl00_ContentPlaceHolder1_DropDownList片区.FireEvent "onchange"
End SubPrivate Sub ctl00_ContentPlaceHolder1_DropDownList片区_onchange()
'提交
End SubPrivate Sub Form_Load()
WebBrowser1.Navigate2 "http://house.gxsky.com/intermediary/ChuShou.aspx?type=n"
End SubPrivate Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim oDoc As HTMLDocument
Set oDoc = pDisp.Document
With oDoc
Set ctl00_ContentPlaceHolder1_DropDownList城市 = .getElementById("ctl00_ContentPlaceHolder1_DropDownList城市")
Set ctl00_ContentPlaceHolder1_DropDownList区域 = .getElementById("ctl00_ContentPlaceHolder1_DropDownList区域")
Set ctl00_ContentPlaceHolder1_DropDownList片区 = .getElementById("ctl00_ContentPlaceHolder1_DropDownList片区")
ctl00_ContentPlaceHolder1_DropDownList城市.Value = "南宁市"
ctl00_ContentPlaceHolder1_DropDownList城市.FireEvent "onchange"
End With
End Sub
ctl00_ContentPlaceHolder1_DropDownList城市.FireEvent "onchange"
End With
拷贝这么多 我要分啊 没分下载
Private WithEvents dpl城市 As HTMLSelectElement
Private WithEvents dpl区域 As HTMLSelectElement
Private WithEvents dpl片区 As HTMLSelectElementPrivate Sub dpl城市_onchange()
SelectByDisplayText dpl区域, "良庆区"
End SubPrivate Sub dpl区域_onchange()
SelectByDisplayText dpl片区, "五象新区"
End SubPrivate Sub dpl片区_onchange()
'提交
End SubPrivate Sub Form_Load()
WebBrowser1.Navigate2 "http://www.nn-sky.com"
End SubPrivate Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
'一天一个梦
'000000
If LCase(URL) <> "http://www.nn-sky.com/user/house_fabu.asp" Then Exit Sub
Dim oDoc As HTMLDocument
Set oDoc = pDisp.Document
With oDoc
Set dpl城市 = .getElementById("city_one")
Set dpl区域 = .getElementById("city_two")
Set dpl片区 = .getElementById("city_three")
If dpl城市 Is Nothing Then Exit Sub
If dpl区域 Is Nothing Then Exit Sub
If dpl片区 Is Nothing Then Exit Sub
SelectByDisplayText dpl城市, "南宁市"
End With
End Sub
Private Sub SelectByDisplayText(dpl As HTMLSelectElement, ByVal sSelectText As String)
Dim opt As HTMLOptionElement
For Each opt In dpl.Options
If opt.Text = sSelectText Then
opt.Selected = True
dpl.FireEvent "onchange"
Exit Sub
End If
Next
End Sub
Private WithEvents dpl城市 As HTMLSelectElement
Private WithEvents dpl区域 As HTMLSelectElement
Private WithEvents dpl片区 As HTMLSelectElementPrivate Sub dpl城市_onchange()
SelectByDisplayText dpl区域, "良庆区"
End SubPrivate Sub dpl区域_onchange()
SelectByDisplayText dpl片区, "五象新区"
End SubPrivate Sub dpl片区_onchange()
'提交
End SubPrivate Sub Form_Load()
WebBrowser1.Navigate2 "http://www.nn-sky.com"
End SubPrivate Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
'一天一个梦
'000000
If LCase(URL) <> "http://www.nn-sky.com/user/house_fabu.asp" Then Exit Sub
Dim oDoc As HTMLDocument
Set oDoc = pDisp.Document
With oDoc
Set dpl城市 = .getElementById("city_one")
Set dpl区域 = .getElementById("city_two")
Set dpl片区 = .getElementById("city_three")
If dpl城市 Is Nothing Then Exit Sub
If dpl区域 Is Nothing Then Exit Sub
If dpl片区 Is Nothing Then Exit Sub
SelectByDisplayText dpl城市, "南宁市"
End With
End Sub
Private Sub SelectByDisplayText(dpl As HTMLSelectElement, ByVal sSelectText As String)
Dim opt As HTMLOptionElement
For Each opt In dpl.Options
If opt.Text = sSelectText Then
opt.Selected = True
dpl.FireEvent "onchange"
Exit Sub
End If
Next
End Sub