webbrowser提交radio的方法
<li class="" id="op8492">
<input id="option0" name="option" type="radio" value="8492" />
<label for="option0">
没<br /> </label>
</li>
<li class="" id="op8493">
<input id="option1" name="option" type="radio" value="8493" />
<label for="option1">
有<br /> </label>
</li>
<li class="" id="op8494">
<input id="option2" name="option" type="radio" value="8494" />
<label for="option2">
概念阶段<br /> </label>
</li>
<li class="" id="op8495">
<input id="option3" name="option" type="radio" value="8495" />
<label for="option3">
火星上有 </label>
</li>
以上是个radio,我想动态的按照id选择option0 checked或者option1 checked.....
请给段代码,高分送上
[解决办法]
var
doc: IHTMLDocument2;
inputElement: IHTMLInputElement;
begin
doc := wb1.Document as IHTMLDocument2;
inputElement := doc.all.item('option',0) as IHTMLInputElement; //item的第二个参数就是第几个radio
if Assigned(inputElement) and (inputElement.type_ = 'radio') then
inputElement.checked := True;
end;
[解决办法]
WebBrowser1.Navigate('javascript:document.getElementById("option0").checked=true;void(0);');