我想选中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. which
B:B. with whom
C:C. whom
D:D. with which