webbrowser控件中选定radio项的问题
页面上有三个radio,如下:
<INPUT type= "radio " id=DeliveryID value=1029 NAME= "DeliveryID ">
<INPUT type= "radio " id=DeliveryID value=1028 NAME= "DeliveryID ">
<INPUT type= "radio " id=DeliveryID value=1050 NAME= "DeliveryID ">
我需要让程序选中value=1029的那个radio,代码应该怎么写
------解决方案--------------------//项目中添加Micrsoft.mshtml引用
using mshtml;
IHTMLDocument2 vDocument =
(IHTMLDocument2)webBrowser1.Document.DomDocument;
foreach (IHTMLElement vElement in vDocument.all)
{
if (vElement.tagName.ToLower() == "input ")
{
IHTMLInputElement vInputElement = (IHTMLInputElement)vElement;
if (vInputElement.type.ToLower() == "radio " &&
vInputElement.value.ToLower() == "1029 ")
vInputElement.@checked = true;
}
}