我找不到的语法错误 - 可能会影响其他事情
Syntax error that I can not find - may be affecting other things
我想我有一个语法错误可能会影响我店里的其他东西。
这个错误刚刚开始弹出:
(index):1544 Uncaught SyntaxError: Unexpected token <
索引的第 1544 行,正如我在源代码下的控制台中看到的那样:
1544 <script text="text/javascript">
我从未见过 'text=text' 所以我想知道这是否是导致错误的原因。最重要的是我们的产品拇指指甲没有反应,而且似乎还有其他负面影响,这是其他错误:
ERROR: product.functions.js:382 Uncaught ReferenceError: ProductThumbWidth is not defined
ERROR: product.functions.js:291 Uncaught ReferenceError: CurrentProdThumbImage is not defined(index):1609 Uncaught
ERROR: ReferenceError: ShowVariationThumb is not defined
我想在继续处理其余部分之前处理第一个语法错误消息,我认为修复它可能会修复其他问题,我认为它来自这里,ProductDetails.html。可能缺少脚本标签,但我从未接触过这个文件,所以我不知道为什么会突然发生,并且注释掉的代码似乎不应该影响它。
<script type="text/javascript">
var google_tag_params = {
ecomm_prodid: %%GLOBAL_ProductId%%,
ecomm_pagetype: 'product',
ecomm_totalvalue: parseFloat('%%GLOBAL_ProductPrice%%'.replace("$","").replace(",",""))
};
</script>
<link rel="stylesheet" type="text/css" href="%%GLOBAL_CdnAppPath%%/javascript/jquery/themes/cupertino/ui.all.css?%%GLOBAL_JSCacheToken%%" />
<link rel="stylesheet" type="text/css" media="screen" href="%%GLOBAL_productAttributesCssPath%%?%%GLOBAL_JSCacheToken%%" />
<script type="text/javascript" src="%%GLOBAL_jQueryUIPath%%"></script>
<script type="text/javascript" src="%%GLOBAL_CdnAppPath%%/javascript/jquery/plugins/jquery.form.js?%%GLOBAL_JSCacheToken%%"></script>
<script type="text/javascript" src="%%GLOBAL_CdnAppPath%%/javascript/product.attributes.js?%%GLOBAL_JSCacheToken%%"></script>
<script type="text/javascript" src="%%GLOBAL_CdnAppPath%%/javascript/jquery/plugins/jCarousel/jCarousel.js?%%GLOBAL_JSCacheToken%%"></script>
%%SNIPPET_ProductImageZoomer%%
<script type="text/javascript">//<![CDATA[
var ThumbURLs = new Array();
var ProductImageDescriptions = new Array();
var CurrentProdThumbImage = %%GLOBAL_CurrentProdThumbImage%%;
var ShowVariationThumb =false;
var ProductThumbWidth = %%GLOBAL_ProductThumbWidth%%;
var ProductThumbHeight = %%GLOBAL_ProductThumbHeight%%;
var ProductMaxZoomWidth = %%GLOBAL_ProductMaxZoomWidth%%;
var ProductMaxZoomHeight = %%GLOBAL_ProductMaxZoomHeight%%;
var ProductTinyWidth = %%GLOBAL_ProductMaxTinyWidth%%;
var ProductTinyHeight = %%GLOBAL_ProductMaxTinyHeight%%;
%%GLOBAL_ProdImageJavascript%%
//Don't enable Cloud Zoom (product image zoom) on touch device
//Mouseenter/Mouseover events are not ideal for touch devices
//for more info search for this code in /script/main.js
<script type="text/javascript">
var _learnq = _learnq || [];
var item = {
Name: "%%GLOBAL_ProductName%%",
ProductID: %%GLOBAL_ProductId%%,
ImageURL: "%%GLOBAL_CurrentProdThumbImage%%",
URL: window.location.origin + window.location.pathname,
Brand: "%%GLOBAL_BrandName%%",
Price: "%%GLOBAL_ProductPrice%%",
CompareAtPrice: "%%GLOBAL_RetailPrice%%"
};
_learnq.push(['track', 'Viewed Product', item]);
_learnq.push(['trackViewedItem', {
Title: item.Name,
ItemId: item.ProductID,
ImageUrl: item.ImageURL,
Url: item.URL,
Metadata: {
Brand: item.Brand,
Price: item.Price,
CompareAtPrice: item.CompareAtPrice
}
}]);
</script>
<script type="text/javascript">
if (('ontouchstart' in window) || (navigator.msMaxTouchPoints > 0)){
var ShowImageZoomer = false;
} else {
var ShowImageZoomer = %%GLOBAL_ShowImageZoomer%%;
}
var productId = %%GLOBAL_ProductId%%;
//]]></script>
以下是控制台错误的屏幕和源选项卡:
非常感谢任何帮助!
改变
<script text="text/javascript">
到
<script type="text/javascript">
是type=
不是text=
没有看到你整个页面我只是猜测,但从错误看来你已经在第 1544 行的 <script>
标签中。
仔细检查您的来源,也许您没有关闭之前的 <script>
标签。
之后你应该使用 type="text/javascript"
尽管它是默认的并且不是必需的,你可以只使用 <script>...</script>
.
我想我有一个语法错误可能会影响我店里的其他东西。 这个错误刚刚开始弹出:
(index):1544 Uncaught SyntaxError: Unexpected token <
索引的第 1544 行,正如我在源代码下的控制台中看到的那样:
1544 <script text="text/javascript">
我从未见过 'text=text' 所以我想知道这是否是导致错误的原因。最重要的是我们的产品拇指指甲没有反应,而且似乎还有其他负面影响,这是其他错误:
ERROR: product.functions.js:382 Uncaught ReferenceError: ProductThumbWidth is not defined
ERROR: product.functions.js:291 Uncaught ReferenceError: CurrentProdThumbImage is not defined(index):1609 Uncaught
ERROR: ReferenceError: ShowVariationThumb is not defined
我想在继续处理其余部分之前处理第一个语法错误消息,我认为修复它可能会修复其他问题,我认为它来自这里,ProductDetails.html。可能缺少脚本标签,但我从未接触过这个文件,所以我不知道为什么会突然发生,并且注释掉的代码似乎不应该影响它。
<script type="text/javascript">
var google_tag_params = {
ecomm_prodid: %%GLOBAL_ProductId%%,
ecomm_pagetype: 'product',
ecomm_totalvalue: parseFloat('%%GLOBAL_ProductPrice%%'.replace("$","").replace(",",""))
};
</script>
<link rel="stylesheet" type="text/css" href="%%GLOBAL_CdnAppPath%%/javascript/jquery/themes/cupertino/ui.all.css?%%GLOBAL_JSCacheToken%%" />
<link rel="stylesheet" type="text/css" media="screen" href="%%GLOBAL_productAttributesCssPath%%?%%GLOBAL_JSCacheToken%%" />
<script type="text/javascript" src="%%GLOBAL_jQueryUIPath%%"></script>
<script type="text/javascript" src="%%GLOBAL_CdnAppPath%%/javascript/jquery/plugins/jquery.form.js?%%GLOBAL_JSCacheToken%%"></script>
<script type="text/javascript" src="%%GLOBAL_CdnAppPath%%/javascript/product.attributes.js?%%GLOBAL_JSCacheToken%%"></script>
<script type="text/javascript" src="%%GLOBAL_CdnAppPath%%/javascript/jquery/plugins/jCarousel/jCarousel.js?%%GLOBAL_JSCacheToken%%"></script>
%%SNIPPET_ProductImageZoomer%%
<script type="text/javascript">//<![CDATA[
var ThumbURLs = new Array();
var ProductImageDescriptions = new Array();
var CurrentProdThumbImage = %%GLOBAL_CurrentProdThumbImage%%;
var ShowVariationThumb =false;
var ProductThumbWidth = %%GLOBAL_ProductThumbWidth%%;
var ProductThumbHeight = %%GLOBAL_ProductThumbHeight%%;
var ProductMaxZoomWidth = %%GLOBAL_ProductMaxZoomWidth%%;
var ProductMaxZoomHeight = %%GLOBAL_ProductMaxZoomHeight%%;
var ProductTinyWidth = %%GLOBAL_ProductMaxTinyWidth%%;
var ProductTinyHeight = %%GLOBAL_ProductMaxTinyHeight%%;
%%GLOBAL_ProdImageJavascript%%
//Don't enable Cloud Zoom (product image zoom) on touch device
//Mouseenter/Mouseover events are not ideal for touch devices
//for more info search for this code in /script/main.js
<script type="text/javascript">
var _learnq = _learnq || [];
var item = {
Name: "%%GLOBAL_ProductName%%",
ProductID: %%GLOBAL_ProductId%%,
ImageURL: "%%GLOBAL_CurrentProdThumbImage%%",
URL: window.location.origin + window.location.pathname,
Brand: "%%GLOBAL_BrandName%%",
Price: "%%GLOBAL_ProductPrice%%",
CompareAtPrice: "%%GLOBAL_RetailPrice%%"
};
_learnq.push(['track', 'Viewed Product', item]);
_learnq.push(['trackViewedItem', {
Title: item.Name,
ItemId: item.ProductID,
ImageUrl: item.ImageURL,
Url: item.URL,
Metadata: {
Brand: item.Brand,
Price: item.Price,
CompareAtPrice: item.CompareAtPrice
}
}]);
</script>
<script type="text/javascript">
if (('ontouchstart' in window) || (navigator.msMaxTouchPoints > 0)){
var ShowImageZoomer = false;
} else {
var ShowImageZoomer = %%GLOBAL_ShowImageZoomer%%;
}
var productId = %%GLOBAL_ProductId%%;
//]]></script>
以下是控制台错误的屏幕和源选项卡:
非常感谢任何帮助!
改变
<script text="text/javascript">
到
<script type="text/javascript">
是type=
不是text=
没有看到你整个页面我只是猜测,但从错误看来你已经在第 1544 行的 <script>
标签中。
仔细检查您的来源,也许您没有关闭之前的 <script>
标签。
之后你应该使用 type="text/javascript"
尽管它是默认的并且不是必需的,你可以只使用 <script>...</script>
.