1,502
社区成员
发帖
与我相关
我的任务
分享
Option Explicit
Private WithEvents dpl城市 As HTMLSelectElement
Private WithEvents dpl区域 As HTMLSelectElement
Private WithEvents dpl片区 As HTMLSelectElement
Private Sub dpl城市_onchange()
SelectByDisplayText dpl区域, "良庆区"
End Sub
Private Sub dpl区域_onchange()
SelectByDisplayText dpl片区, "五象新区"
End Sub
Private Sub dpl片区_onchange()
'提交
End Sub
Private Sub Form_Load()
WebBrowser1.Navigate2 "http://www.nn-sky.com"
End Sub
Private 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 HTMLSelectElement
Private Sub ctl00_ContentPlaceHolder1_DropDownList城市_onchange()
ctl00_ContentPlaceHolder1_DropDownList区域.Value = "青秀区"
ctl00_ContentPlaceHolder1_DropDownList区域.FireEvent "onchange"
End Sub
Private Sub ctl00_ContentPlaceHolder1_DropDownList区域_onchange()
ctl00_ContentPlaceHolder1_DropDownList片区.Value = "柳沙"
ctl00_ContentPlaceHolder1_DropDownList片区.FireEvent "onchange"
End Sub
Private Sub ctl00_ContentPlaceHolder1_DropDownList片区_onchange()
'提交
End Sub
Private Sub Form_Load()
WebBrowser1.Navigate2 "http://house.gxsky.com/intermediary/ChuShou.aspx?type=n"
End Sub
Private 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