Click here to Skip to main content
15,885,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:
JavaScript
function grandTotal(){
	var totalEntries = 182;
	var totalSum = 0;
	var total = [];
	var prices = [];
		prices[0] = 4.5;//Embroiders $4.50
		prices[1] = 9;//Short Sleeve S,M,L,XL
		prices[2] = 12;//Short Sleeve XXL, 3XL, 4XL  Long SLeeve S,M,L,XL
		prices[3] = 15;//Long Sleeve XXL, 3XL
		prices[4] = 14;//SPSweatshirts S,M,L,XL
		prices[5] = 18;//SPSweatshirts XL, XXL, 3XL, 4XL, 5XL Non-zip hoodie  S,M,L
		prices[6] = 18.5;//Embroidered Men Polo  S,M,L,XL  Women's Polos S,M,L,XL
		prices[7] = 19.5;//Embroidered Men Polo XXL  Women's Polo XXL
		prices[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,XL
		prices[9] = 22;//Y-placket polo S,M,L,XL
		prices[10] = 24.5;//y-placket polo XXL (M/F) Mechanics Shirt S,M,L,XL Embroidered Zip Hoodie S,M,L,XL
		prices[11] = 28;//y-placket polo 3XL  Men's 1/4 zip fleece 3XL (M/F)Full Zip Fleece 3XL
		prices[12] = 24;//Men's 1/4 zip fleece XXL  (M/F)Full Zip Fleece XXL
		prices[13] = 26.5;//(M/F)Mechanics Shirt XXL
		prices[14] = 29.5;//Zip Hoodie XXL,3XL
		prices[15] = 23.5;//Non-zip Hoodie XL,XXL
		prices[16] = 8.5;//Hats
	var 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 each
		
	for(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];
		}
The problem is with
JavaScript
pricesAll[44] = 18;
Any help would be appreciated. Thanks.
Posted

1 solution

In the small code block you show the line as:
C#
pricesAll[44] = 18;

but in the full code block it is:
C#
pricesAll{44} = 18;

Note: curlyBraces {} not squareBrackets []
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900