http://jianchaowuhui.blog.163.com/blog/static/969165892009112114814703/
Private Sub Command1_Click() Web.Navigate2 "http://reg.jx3.xoyo.com/reg.php" ‘打开网页
End Sub
'下边就是关健操作代码了
Private Sub Command2_Click()( }( ~/ u) Q! G5 {% g6 o! s% \
Dim vDoc As String, vTag As String, mType As String, mTagName As String, i As Integer
Set vDoc = Web.Document& X5 J) O7 Q1 G. Z6 T9 \8 Z0 T
For i = 0 To vDoc.All.length - 1" |' w P' s& M# k- i! ?
Select Case UCase(vDoc.All(i).tagName)
Case "SELECT" '"SELECT"标签,多选框的选择
Set vTag = vDoc.All(i)
2 C1 o; J+ |+ P& j- W( N
Select Case LCase(vTag.Name); X( I6 A: `. b: \
. n6 @& B" a5 P6 d. B: q
Case "age_section" '年龄选第1个
! Q# Y% o( K% |5 @. W
vTag.selectedIndex = 1; Y- \, T1 M x- B- o C* S
Case "work" '工作选第2个
vTag.selectedIndex = 2
End Select
Case "TEXTAREA" '"TEXTAREA" 标签,文本框的填写
5 _! ^; }8 w2 ~: j# J) t9 C2 \" Q
Set vTag = vDoc.All(i)/ ?3 l2 e: E- T3 U4 N
vTag.Value = Text2.Text '将Text2中的内容填入 r% C4 s1 C8 H- N8 ?" P# B
8 g9 E; A. k: {4 w) u: |& i6 \! W
Case "INPUT" '"INPUT" 标签
Set vTag = vDoc.All(i)' l8 j& m7 I: q7 _: b# B
mType = LCase(vTag.Type)
Select Case mType
Case "text" '文本输入 W1 `3 `/ |* y1 n0 G) r$ `
Select Case LCase(vTag.Name)3 H/ Y2 \0 S$ `0 ?" y1 F
Case "ppt_1"
vTag.Value = Text1.Text" t: k7 H* i; ]. I1 k
Case "ppt_2"' T! ]; k0 P% q
vTag.Value = Text1.Text
Case "username"6 `: @& Z0 H% I1 O$ W
vTag.Value = Text4.Text$ \- O6 P: V- a3 B: x
Case "email"" Q" q, p6 \! g$ t
vTag.Value = Text3.Text + Combo1.Text
Case "email2"
vTag.Value = Text3.Text + Combo1.Text
Case "phone"# w3 Z# L8 A& e2 c
vTag.Value = Text5.Text
Case "qq"
vTag.Value = Text6.Text
End Select
Case "radio" '单选框的选择
Select Case LCase(vTag.Name) t0 s! _9 n- {+ B' x
Case "sex"/ e& W: y. L" U6 _* _
If vTag.id = "sex_1" Then vTag.Checked = True. k( L4 t4 y' B$ K `
Case "ks_game"
If vTag.id = "ks_game_2" Then vTag.Checked = True
Case "other_game"
If vTag.id = "other_game_3" Then vTag.Checked = True
Case "is_feedback"' ^4 a9 F0 }0 |; j# S' e0 b
If vTag.id = "is_feedback_1" Then vTag.Checked = True
End Select
End Select
End Select# j# G' t+ T* {- f6 P0 {
Next i1 R- V& m" g0 q2 g) T& a( t9 |
End Sub