【发布时间】:2017-06-20 08:31:27
【问题描述】:
我的 Html 如下所示:
<div id="associatedAPListTable" style="float:left"><Associated (Destination)>
<table border="0" cellspacing="0" cellpadding="0" class="listContainer" align="center" >
<thead>
<tr>
<th class="tableheader" align="left" width="170">MAC address</th>
<th class="tableheader" align="left" width="170">LradName</th>
</tr>
</thead>
<tbody id="associated_tablebody">
</tbody>
</table>
</div>
我的 javascript 如下所示:
function getAssociatedList(){
var associatedAPListArray=[];
var xhrArgs = {
url:"abc/sample/resource",
preventCache: true,
contentType: "application/json"
};
var deferred = dojo.xhrGet(xhrArgs);
deferred.addCallback(function(response){
var associatedApListObj = dojo.fromJson(response);
var firstJsonObject;
var row = '';
for (i=0; i <= dojo.fromJson(associatedApListObj.items).length-1; i++){
firstJsonObject = dojo.fromJson(associatedApListObj.items)[i];
var MacAddress = firstJsonObject.MacAddress;
var LradName=firstJsonObject.LradName;
var style_td='<td align="left" width="170">';
row+='<tr>'+style_td+'<input type="radio"'+'id="associated_'+i+'" name="associatedAp"/ >'+MacAddress+'</td>'+style_td+LradName+'</td></tr>';
}
document.getElementById('associated_tablebody').innerHTML = row;
});
}
所以,既然我已经创建并显示了这些单选按钮, 我需要获取选中的单选按钮的值。有人可以告诉我如何做到这一点是 Javascript 而不是 jQuery?
【问题讨论】:
标签: javascript html arrays dynamic radio-button