与单选按钮Web浏览器控件交互 [英] Interacting with radio button webbrowser control
本文介绍了与单选按钮Web浏览器控件交互的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好!首先,我想先感谢您的帮助,非常感谢!
所以基本上我有这种形式,就文本框而言,我一切都很好,但这就是html代码在页面上的样子:
Hi all! First off, I''d like to say thanks for any help in advance, it''s much appreciated!
So basically i have this form, I''ve got everything good so far as textboxes go, but this is what the html code looks like on the page:
<td><input type="radio" name="pw" value="yes" />Yes <input type="radio" name="pw" value="no" />No</td>
我无法修改页面,所以这是不可能的.这是我的一部分代码:
I can''t modify the page whatsoever, so that''s out of the question. Here''s my piece of the code:
Dim theElementCollection As HtmlElementCollection = frmMain.wbOffScreen.Document.GetElementsByTagName("Input")
For Each curElement As HtmlElement In theElementCollection
Dim controlName As String = curElement.GetAttribute("name").ToString
If controlName = "pw" Then
curElement.SetAttribute("Checked", "yes")
End If
Next
End Sub
每次加载此文件时,它都会选择否",这与我需要听到她的发言相反. :/
再次感谢您的帮助!
Each time I load this, it selects "No" Which is the opposite of what I need to hear her say. :/
Once again thanks for any help!
推荐答案
我建议您将RadioButtonList
用于此任务.其次,如果您希望在页面加载时选择Yes
,那么当ispostback
是false
时在page_load
内部执行.
I recommend you use theRadioButtonList
for this task. Secondly if you wantYes
to be selected when page loads then do that insidepage_load
whenispostback
isfalse
.
这篇关于与单选按钮Web浏览器控件交互的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文