Javascript 这是原型中的.innerHTML

Javascript 这是原型中的.innerHTML,javascript,prototypejs,this,Javascript,Prototypejs,This,js代码片段如下所示: function currency_change(value) { // change all currencies on the page $$('label.currency').each(function() { this.innerHTML = value; }); alert(value); } 我知道value是正确的,我知道我正在遍历每个label.currency类,但我似乎无法更改这些元素的innerHTML值 我疯狂地

js代码片段如下所示:

function currency_change(value) {

  // change all currencies on the page
  $$('label.currency').each(function() {

    this.innerHTML = value;

  });
  alert(value);

}
我知道
value
是正确的,我知道我正在遍历每个label.currency类,但我似乎无法更改这些元素的
innerHTML

我疯狂地用谷歌搜索,但我不知道怎么做。我怀疑此
有问题

请尝试以下方法:

$$('label.currency').each(function(element) {
    element.update(value);
});
IE在替换复杂的DOM树时表现出非常差的性能。在这种情况下,请在更新之前删除内部DOM:

$$('label.currency').invoke('childElements').invoke('invoke','remove');
如果是一个元素,你可以说:

$('elementID').childElements().invoke('remove');
$('elementID').childElements().invoke('remove');