Internet explorer 原型&x27;s更新不与IE一起工作

Internet explorer 原型&x27;s更新不与IE一起工作,internet-explorer,prototypejs,Internet Explorer,Prototypejs,我在IE中使用.update更新div的内容时遇到问题;我还尝试了innerHTML,但没有成功。我的脚本在firefox和chrome上运行良好,但我也需要在IE上运行(7和8都不接受这些功能)。有什么提示吗? 提前谢谢 上下文是一个简单的购物车,带有两个微调器按钮,用于修改要购买的商品数量。代码如下: <!-- the input (quantity) --> <input type="text" class="cant" id="m__1" value="0" siz

我在IE中使用.update更新div的内容时遇到问题;我还尝试了innerHTML,但没有成功。我的脚本在firefox和chrome上运行良好,但我也需要在IE上运行(7和8都不接受这些功能)。有什么提示吗? 提前谢谢

上下文是一个简单的购物车,带有两个微调器按钮,用于修改要购买的商品数量。代码如下:

<!-- the input (quantity) -->
<input type="text" class="cant" id="m__1" value="0"
  size="2" readonly/>
<!-- the price associated with the input -->
<input type="hidden" id="h__1" name="h__1" value="100"/>
<!-- the "addition" spinner button for the quantity -->
<input type=button value=" + " onclick="$('m__1').value++;recalc();"
  style="font-size:11px;margin:0;padding:0;width:20px;height:19px;" >

<!-- the js function -->
function recalc() {

  total = 0
  $$('input.cant').each(function(field) {
    var idprice = 'h__' + field.id.substr(3)
    var price = parseFloat($F(idprice))
    var quant = parseInt(field.value)

    total += (quant * price)
  });
  $('totcart').innerHTML='Total ' + total
  return total
}

<!-- the div -->
<div align="right" id="totcart"></div>

函数recalc(){
总数=0
$$('input.cant')。每个(函数(字段){
var idprice='h_u;'+field.id.substr(3)
var价格=浮动汇率($F(idprice))
var quant=parseInt(field.value)
合计+=(数量*价格)
});
$('totcart').innerHTML='Total'+Total
返回总数
}

现在没有足够的时间查看,但将代码更改为此会使其正常工作:

function recalc() {
  total = 0
  $$('input.cant').each(function(field) {
    var idprice = 'h__' + field.id.substr(3)
    var price = parseFloat($F(idprice))
    var quant = parseInt(field.value)
    total += (quant * price)
  });
  $('totcart').innerHTML='Total ' + total
  return total
}
document.observe("dom:loaded",function(){
    $('changer').observe("click",function(){
        $('m__1').value++;
        recalc();
    });     
});


<!-- the input (quantity) -->
<input type="text" class="cant" id="m__1" value="0" size="2" readonly/>
<!-- the price associated with the input -->
<input type="hidden" id="h__1" name="h__1" value="100"/>
<!-- the "addition" spinner button for the quantity -->
<input type=button value=" + " id="changer"  style="font-size:11px;margin:0;padding:0;width:20px;height:19px;" >
<!-- the div -->
<div align="right" id="totcart"></div>
函数recalc(){
总数=0
$$('input.cant')。每个(函数(字段){
var idprice='h_u;'+field.id.substr(3)
var价格=浮动汇率($F(idprice))
var quant=parseInt(field.value)
合计+=(数量*价格)
});
$('totcart').innerHTML='Total'+Total
返回总数
}
document.observe(“dom:loaded”,function()){
$('changer')。观察(“单击”,函数(){
$('m_u1')。值++;
recalc();
});     
});