问题描述
- c# webbrowser 自动选择 radio问题
-
我想选中radio中指定选项,可是代码没生效,大家帮我看看哪里的问题呗我的代码。外面的循环已经能够定位到指定题目,得到name,然后我用
ele.SetAttribute("checked", "checked");或者H_timu.SetAttribute("value", "RadioButton1");都不能选中指定选项。string subtext = alltext.Substring(a, 400); int b = subtext.IndexOf("name="); string timuname = subtext.Substring(b+5,18); HtmlElement H_timu = webBrowser1.Document.All[timuname]; textBox4.Text += timuname; H_timu.SetAttribute("value", "RadioButton1"); /* foreach (HtmlElement ele in webBrowser1.Document.GetElementsByTagName(timuname)) { textBox4.Text += "0"; if (ele.GetAttribute("value") == "RadioButton1") { ele.SetAttribute("checked", "checked"); } } */
网页radio内容,这里只列举一个,我已经实现了题目的定为,
A:A. whichB:B. with whom
C:C. whom
D:D. with which
解决方案
添加几个alert()跟一下
解决方案二:
http://bbs.csdn.net/topics/110019646
时间: 2024-10-27 00:44:50