WebBrowser控件HTMLDocument自动选择选项单选 [英] WebBrowser control HTMLDocument automate selecting option radio

查看:76
本文介绍了WebBrowser控件HTMLDocument自动选择选项单选的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将网页加载到C#中的Web浏览器控件中,并且我需要将所有单选框设置为no.我不知道如何告诉程序选择网页中的收音机,然后为它们选择是或否.
如何在webBrowser控件中选择那些收音机?使用c Sharp

这是我的代码

I am trying to have a webpage load into the web browser control in C# and I need all the radio boxes to already be set to no. I dont know how to tell the program to select those radios that are in the webpage and to then select yes or no to them.
How can I select those radios in the webBrowser control? using c Sharp

here is my code

<input type="radio" name="browser" value="IE" checked>
Internet Explorer<br>

<input type="radio" name="browser" value="Mozilla">
Mozilla<br>

<input type="radio" name="browser" value="Opera">
Opera<br>

推荐答案

使用checked属性:
Use the checked attribute:
<input type="radio" name="browser" value="IE" checked="true"></input>



参见此处以获取解释: W3Schools [
如果您需要在未选中任何一项的情况下,请添加无"单选框,或将其转换为复选框而不是单选框.



See here for explanation: W3Schools[^]

You can''t have all the radio boxes set to "no": that isn''t how radio buttons work. One of them is always set to true.

If you need a case when none of them are checked, either add a "None" Radiobox, or convert them to checkboxes instead of radio.

<input type="checkbox" name="browser" value="IE">Internet Explorer<br>


这篇关于WebBrowser控件HTMLDocument自动选择选项单选的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆