比如一个网页里有以下代码 <input type="radio" value="n" checked name="notecome">普通 <input type="radio" value="c" name="notecome">原创 <input type="radio" value="z" name="notecome">转帖 <input type="button" value="发送提交" name="button"webbrowser中这么写:Private Sub Command1_Click() WebBrowser1.Navigate "c:\ggg.html" End SubPrivate Sub Command2_Click() Dim x
For Each x In WebBrowser1.Document.All("notecome") If x.Value = "c" Then x.Checked = True End If Next End Sub ======================================================== 或者下面方法: Dim i As Integer Set vdoc = brow.Document For i = 0 To vdoc.All.Length - 1 '检测所有标签 If UCase(vdoc.All(i).tagName) = "INPUT" Or UCase(vdoc.All(i).tagName) = "TEXTAREA" Then Set vTag = vdoc.All(i) If ucase(vTag.Type) = "CHECKBOX" Then vTag.Checked = True End If End If next i
不行啊,不能检测 Value 或者 Name 属性啊,我要确定一个按钮 并点击它,怎么做啊,那个按钮的源码 <input type=Submit value="提交" name=Submit>
http://dev.csdn.net/article/28/28375.shtm
<input type="radio" value="n" checked name="notecome">普通
<input type="radio" value="c" name="notecome">原创
<input type="radio" value="z" name="notecome">转帖
<input type="button" value="发送提交" name="button"webbrowser中这么写:Private Sub Command1_Click()
WebBrowser1.Navigate "c:\ggg.html"
End SubPrivate Sub Command2_Click()
Dim x
For Each x In WebBrowser1.Document.All("notecome")
If x.Value = "c" Then
x.Checked = True
End If
Next
End Sub
========================================================
或者下面方法:
Dim i As Integer
Set vdoc = brow.Document
For i = 0 To vdoc.All.Length - 1 '检测所有标签
If UCase(vdoc.All(i).tagName) = "INPUT" Or UCase(vdoc.All(i).tagName) = "TEXTAREA" Then
Set vTag = vdoc.All(i)
If ucase(vTag.Type) = "CHECKBOX" Then
vTag.Checked = True
End If
End If
next i
<input type=Submit value="提交" name=Submit>
不知道有没有办法对file对象的value进行赋值呢?