Javascript 使用Prototype更新表内容时出错

Javascript 使用Prototype更新表内容时出错,javascript,html-table,prototypejs,innerhtml,Javascript,Html Table,Prototypejs,Innerhtml,我想在原型中做一些类似的事情: onSuccess: function(transport) { template = transport.responseText.evalJSON(); form = event.up('form'); form.select('.audio_channels').update(template.channelHtml); } 表单标记是一个表,我想替换它的内容channelHtml是一组HTML标记 我得到: TypeError:对

我想在原型中做一些类似的事情:

onSuccess: function(transport) {
    template = transport.responseText.evalJSON();
    form = event.up('form');
    form.select('.audio_channels').update(template.channelHtml);
}
表单标记是一个表,我想替换它的内容
channelHtml
是一组HTML
标记

我得到:

TypeError
:对象
[Object HTMLTableElement]
没有方法“update”

所以我认为它不是一个扩展对象,并尝试了
元素.extend(form.select('audio_channels'))
,它返回一个空对象。然后我尝试
form.select('.audio\u channels').innerHTML(template.channelHtml)
并得到
TypeError:Object[Object HTMLTableElement]没有方法“innerHTML”
。然后我尝试使用tbody元素,得到
[object-HTMLTableSectionElement]没有方法'innerHtml'


在我看来,这应该行得通
form.select('audio\u channels')
返回正确的DOM元素。根据ajax调用设置表的内容需要做什么?

将最后一行替换为

form.select('.audio_channels').each(function(node){
  node.update(template.channelHtml);
});
这将在实际元素上执行代码,而不是像原始代码那样在一个项目数组上执行代码