相关疑难解决方法(0)

如何使用javascript获取单选按钮的值

我需要使用javascript获取单选按钮的值

我有一个名为选择的广播组

<input type="radio" name="selection" id="selection" value="allClients" checked="checked" />All Clients<br />
          <input type="radio" name="selection" id="selection1" value="dateRange" />Date Range between 
Run Code Online (Sandbox Code Playgroud)

我使用javascript将值传递给另一个页面

onclick="do_action1('liveClickCampaigns','contract_type='+document.getElementById('contract_type').value+'&beginDate='+document.getElementById('beginDate').value+'&endDate='+document.getElementById('endDate').value+'&selection1='+document.getElementById('selection1').value+'&selection='+document.getElementById('selection').value,'content');" type="button">
Run Code Online (Sandbox Code Playgroud)

document.getElementById('selection').value需要获取值,但即使选择了第二个单选按钮,它仍然会给我第一个单选按钮的值.广播组不在表格内

html javascript

2
推荐指数
1
解决办法
8182
查看次数

标签 统计

html ×1

javascript ×1