本文介绍了SCRIPT1004:预期';'当一个 ';'在那儿。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我正在为我的机器人团队开发一个HTML购物车,我遇到了IE显示的错误。它说:SCRIPT1004:预期';'。我无法弄清楚的是我修复了这个问题,但它仍然说缺少分号。以下是我遇到问题的部分代码如果有帮助:Hi,I am working on a HTML shopping cart for my robotics team and I have run across an error displayed by IE. It says: SCRIPT1004: Expected ';'. What I cant figure out is that I fixed the issue but it still says the semi-colon is missing. Here is the portion of the code I am having trouble with if it helps:function grandTotal(){var totalEntries = 182;var totalSum = 0;var total = [];var prices = [];prices[0] = 4.5;//Embroiders $4.50prices[1] = 9;//Short Sleeve S,M,L,XLprices[2] = 12;//Short Sleeve XXL, 3XL, 4XL Long SLeeve S,M,L,XLprices[3] = 15;//Long Sleeve XXL, 3XLprices[4] = 14;//SPSweatshirts S,M,L,XLprices[5] = 18;//SPSweatshirts XL, XXL, 3XL, 4XL, 5XL Non-zip hoodie S,M,Lprices[6] = 18.5;//Embroidered Men Polo S,M,L,XL Women's Polos S,M,L,XLprices[7] = 19.5;//Embroidered Men Polo XXL Women's Polo XXLprices[8] = 22.5;//Embroidered Men Polo 3XL Women's Polo 3XL Men's 1/4 zip fleece S,M,L,XL Full Zip Fleece S,M,L,XLprices[9] = 22;//Y-placket polo S,M,L,XLprices[10] = 24.5;//y-placket polo XXL (M/F) Mechanics Shirt S,M,L,XL Embroidered Zip Hoodie S,M,L,XLprices[11] = 28;//y-placket polo 3XL Men's 1/4 zip fleece 3XL (M/F)Full Zip Fleece 3XLprices[12] = 24;//Men's 1/4 zip fleece XXL (M/F)Full Zip Fleece XXLprices[13] = 26.5;//(M/F)Mechanics Shirt XXLprices[14] = 29.5;//Zip Hoodie XXL,3XLprices[15] = 23.5;//Non-zip Hoodie XL,XXLprices[16] = 8.5;//Hatsvar pricesAll = [];pricesAll[0] = 9;pricesAll[1] = -1;pricesAll[2] = 9;pricesAll[3] = -1;pricesAll[4] = 9;pricesAll[5] = -1;pricesAll[6] = 12;pricesAll[7] = -1;pricesAll[8] = 12;pricesAll[9] = -1;pricesAll[10] = -1;pricesAll[11] = -1;pricesAll[12] = -1;pricesAll[13] = 12;pricesAll[14] = -1;pricesAll[15] = -1;pricesAll[16] = 12;pricesAll[17] = -1;pricesAll[18] = 12;pricesAll[19] = -1;pricesAll[20] = 12;pricesAll[21] = -1;pricesAll[22] = 12;pricesAll[23] = -1;pricesAll[24] = 12;pricesAll[25] = -1;pricesAll[26] = 15;pricesAll[27] = -1;pricesAll[28] = 15;pricesAll[29] = -1;pricesAll[30] = 14;pricesAll[31] = -1;pricesAll[32] = 14;pricesAll[33] = -1;pricesAll[34] = 14;pricesAll[35] = -1;pricesAll[36] = 14;pricesAll[37] = -1;pricesAll[38] = 18;pricesAll[39] = -1;pricesAll[40] = 18;pricesAll[41] = -1;pricesAll[42] = 18;pricesAll[43] = -1;pricesAll{44} = 18;var entryNum = 0;//keeps entry no. for eachfor(var p = 0; p <= 44; p += 1) { //totalEntries; p+=1){ if (pricesAll[p] != -1) {console.log("calculating p value" + p)var curValue = Math.floor(document.getElementById("entry_"+p).value);document.getElementById("entry_"+p).value = curValue;totalSum += curValue * pricesAll[p];}问题出在pricesAll[44] = 18;任何帮助将不胜感激。谢谢。 Any help would be appreciated. Thanks.推荐答案 问题出在pricesAll[44] = 18;任何帮助将不胜感激。谢谢。 Any help would be appreciated. Thanks. pricesAll[44] = 18; 但在完整代码块中它是: but in the full code block it is:pricesAll{44} = 18; 注意:curlyBraces {}不是squareBrackets [] Note: curlyBraces {} not squareBrackets [] 这篇关于SCRIPT1004:预期';'当一个 ';'在那儿。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-24 20:08