我很难弄清楚这个错误。控制台告诉我,我在下面加粗的行上的分号引起了“意外令牌”错误。我不知道为什么。该行是:
wrapper.classList.remove(“ hidepricing100”);
archiveContent.WriteString(strOneRecord);
archiveContent.Close();
filePersistent.Close();
CopyFile(FALSE);
答案 0 :(得分:0)
您将(和)放在了else语句之后,而不是{和}:
更正后的代码:
<script>
$(document).ready(function() {
var itemlist = document.getElementsByClassName("costbasedonotherservice");
var basepricearray = [];
for (var i=0; i < itemlist.length; i++) {
var baseprice = itemlist[i].innerText;
basepricearray.push(baseprice);
}
var multiplier = $('#costsbasedonthisservice select :selected').attr('value');
$('#costsbasedonthisservice select').on('change', function() {
var multiplier = $('#costsbasedonthisservice select :selected').attr('value');
for (var i=0; i < itemlist.length; i++) {
var newprice = basepricearray[i]*multiplier;
var newprice2 = Number(newprice).toFixed(2);
var wrapper = itemlist[i].parentElement;
if (newprice2 == 0){
wrapper.classList.add("hidepricing100");
} else {
**wrapper.classList.remove("hidepricing100");**
itemlist[i].innerText = newprice2;
}
}
});
});
</script>