gpt4 book ai didi

javascript - getElementsByClassName 和 IE8 : Object doesn't support this property or method

转载 作者:IT王子 更新时间:2023-10-29 03:02:31 25 4
gpt4 key购买 nike

<分区>

我知道 IE8 不支持“getElementsByClassName”。你知道我可以用什么代替吗?我因错误而烦人

"Object doesn't support this property or method".

HTML代码是:

function sumar() {
var elems = document.getElementsByClassName('verdana14 toAdd');
var myLength = elems.length;
total = 0;
for (var i = 0; i < myLength; ++i) {
if (elems[i].value!="") {
total += parseInt(elems[i].value,10);
}
}

var promedio = total/myLength;
parseFloat(document.getElementById('promediocal').value = promedio.toFixed(2));
}

这是调用 javascript 函数的输入文本:

<input name='AE_EA_1_BIV_003_2' type='text' class='verdana14 toAdd' id='AE_EA_1_BIV_003_2' style='width:50px' onChange='sumar()'/>
<input name='AE_EA_1_BIV_003_3' type='text' class='verdana14 toAdd' id='AE_EA_1_BIV_003_3' style='width:50px' onChange='sumar()'/>
<input name='AE_EA_1_BIV_003_4' type='text' class='verdana14 toAdd' id='AE_EA_1_BIV_003_4' style='width:50px' onChange='sumar()'/>

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com