我有 javascript 函数,它是从 datagrid 调用的关于只选择一个单选按钮并且在 IE 7 上工作正常但现在 IE 9 抛出错误 Microsoft JScript 运行时错误:对象不支持属性或方法“getElementsByTagName”请建议如何修复它
function SelectSingleRadioButton(gridViewId) {
var grid = document.getElementById(gridViewId);
var RadioButtonObj = window.event.srcElement;
for (i = 0; i < grid.rows.length; i++) {
var tr = grid.rows[i];
var td = tr.childNodes[0];
var items = tr.childNodes[0].getElementsByTagName("input") // the point where error is occuring
for (j = 0; j < items.length; j++) {
if (items[j].type == "radio") {
if (RadioButtonObj.id == items[j].id) {
items[j].checked = true;
}
else {
items[j].checked = false;
}
}
}
}
}