SCRIPT1004:预期';'当一个 ';'在那儿。 [英] SCRIPT1004: Expected ';' when a ';' is there.

查看:67
本文介绍了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.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];
		}

问题出在

pricesAll[44] = 18;

任何帮助将不胜感激。谢谢。

Any help would be appreciated. Thanks.

推荐答案

4.50
价格[ 1 ] = 9 ; // 短袖S,M,L,XL
price [ 2 ] = 12 ; // 短袖XXL,3XL,4XL长SLeeve S,M,L,XL
价格[ 3 ] = 15 ; // 长袖XXL,3XL
价格[ 4 ] = 14 ; // SPSweatshirts S,M,L,XL
价格[ 5 ] = 18 ; // SPSweatshirts XL,XXL,3XL,4XL,5XL非z ip hoodie S,M,L
价格[ 6 ] = 18 5 ; // 刺绣男士Polo S,M,L ,XL女装Polo S,M,L,XL
价格[ 7 ] = 19 . 5 ; // 刺绣男士Polo XXL女子马球XXL
价格[ 8 ] = 22 5 ; // 刺绣男士Polo 3XL女士Polo 3XL男士1/4拉链羊毛S,M,L,XL全拉链羊毛S,M,L,XL
价格[ 9 ] = 22 ; // Y-placket polo S,M,L,XL
价格[ 10 ] = 24 5 ; // y-placket polo XXL(M / F)Mechanics S,M,L,XL刺绣拉链连帽衫S,M,L,XL
价格[ 11 ] = 28 ; // y-placket polo 3XL男士1/4拉链羊毛3XL(M / F)全拉链羊毛3XL
价格[< span class =code-digit> 12 ] = 24 ; // 男士1/4拉链羊毛XXL(M / F)全拉链羊毛XXL
价格[ 13 ] = 26 5 ; // < span class =code-comment>(M / F)Mechanics Shirt XXL
price [ 14 ] = 29 5 ; // Zip Hoodie XXL,3XL
价格[ 15 ] = 23 5 ; // 非拉链连帽衫XL,XXL
价格[ 16 ] = 8 5 ; // 帽子
var pricesAll = [];
pricesAll [ 0 ] = 9 ;
priceAll [ 1 ] = -1;
priceAll [ 2 ] = 9 ;
priceAll [ 3 ] = -1;
priceAll [ 4 ] = 9 ;
priceAll [ 5 ] = -1;
priceAll [ 6 ] = 12 ;
priceAll [ 7 ] = -1;
priceAll [ 8 ] = 12 ;
priceAll [ 9 ] = -1;
priceAll [ 10 ] = -1;
priceAll [ 11 ] = -1;
priceAll [ 12 ] = -1;
priceAll [ 13 ] = 12 ;
priceAll [ 14 ] = -1;
priceAll [ 15 ] = -1;
priceAll [ 16 ] = 12 ;
priceAll [ 17 ] = -1;
priceAll [ 18 ] = 12 ;
priceAll [ 19 ] = -1;
priceAll [ 20 ] = 12 ;
priceAll [ 21 ] = -1;
priceAll [ 22 ] = 12 ;
priceAll [ 23 ] = -1;
priceAll [ 24 ] = 12 ;
priceAll [ 25 ] = -1;
priceAll [ 26 ] = 15 ;
priceAll [ 27 ] = -1;
priceAll [ 28 ] = 15 ;
priceAll [ 29 ] = -1;
priceAll [ 30 ] = 14 ;
priceAll [ 31 ] = -1;
priceAll [ 32 ] = 14 ;
priceAll [ 33 ] = -1;
priceAll [ 34 ] = 14 ;
priceAll [ 35 ] = -1;
priceAll [ 36 ] = 14 ;
priceAll [ 37 ] = -1;
priceAll [ 38 ] = 18 ;
priceAll [ 39 ] = -1;
priceAll [ 40 ] = 18 ;
priceAll [ 41 ] = -1;
priceAll [ 42 ] = 18 ;
priceAll [ 43 ] = -1;
priceAll { 44 } = 18 ;


var entryNum = 0 ; // 保留条目号。对于每个

for var p = 0 ; p< = 44 ; p + = 1 ){ // totalEntries; p + = 1){
if (pricesAll [p]!= -1){
console .log( 计算p值 + p)
var curValue = 数学 .floor( document .getElementById( entry _ + p).value);
document .getElementById( entry _+p).value = curValue;
totalSum + = curValue * pricesAll [p];
}
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]; }

问题出在

pricesAll[44] = 18;

任何帮助将不胜感激。谢谢。

Any help would be appreciated. Thanks.


在小代码块中,您将该行显示为:

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



但在完整代码块中它是:


but in the full code block it is:

pricesAll{44} = 18;



注意:curlyBraces {}不是squareBrackets []


Note: curlyBraces {} not squareBrackets []


这篇关于SCRIPT1004:预期';'当一个 ';'在那儿。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆