日期:2014-05-17 浏览次数:20948 次
<body>
<input type="checkbox" name="sex" value="nan" checked="checked" />男
<input type="checkbox" name="sex" value="nv" />女
</body>
private void Form1_Load(object sender, EventArgs e)
{
this.webBrowser1.Url = new Uri(Path.Combine(Application.StartupPath + @"\test.html"));
}
private void button1_Click(object sender, EventArgs e)
{
HtmlElementCollection c = this.webBrowser1.Document.GetElementsByTagName("input");
c.OfType<HtmlElement>().ToList().ForEach(x => x.SetAttribute("checked", "checked"));//设置checkedbox为选中状态
}