日期:2014-05-17  浏览次数:20687 次

HTMLDocument 读网页数据 radio的问题
右键某页面查看源文件有如下的radio
<input type="radio" value="staffNum" id="zdyghhxm1" name="calType_task" />
<input type="radio" value="fltNum" id="zdhbh1" name="calType_task" checked=true />

我想用以下的方式后台让 value="staffNUm"的选项被选中,就是 checked=ture。

axWebBrowser1.Navigate(某网址,ref Zero, ref EmptyString, ref EmptyString, ref EmptyString);

mshtml.IHTMLDocument2 HTMLDocument = (IHTMLDocument2)axWebBrowser1.Document;

IHTMLOptionElement staffNum = (mshtml.IHTMLOptionElement)HTMLDocument.all.item("calType_task", 0);


staffNum.selected=ture;
这样还是没有选中,我想item()里面不能是name吧,因为两个name是一样的,怎样才能通过id读到第一个radio的选项呢?

------解决方案--------------------
IHTMLInputElement 
不是
IHTMLOptionElement 

staffNum.checked=ture;