我认为我的语法错误可能会影响我商店的其他内容。 这个错误刚刚开始出现:
(index):1544 Uncaught SyntaxError: Unexpected token <
索引的第1544行,正如我在控制台下的源代码中看到的那样,有:
1544 <script text="text/javascript">
我从未见过&text; text = text&#39;所以我想知道是否是导致错误的原因。最重要的是,我们的产品拇指指甲不会响应,并且似乎还有其他负面影响,这里是其他错误:
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>
非常感谢任何帮助!
答案 0 :(得分:3)
没有看到你的整个页面,我只是在猜测,但是从错误看来你已经在第1544行的<script>
标签内了。
仔细检查您的来源,也许您没有关闭之前的<script>
代码。
之后你应该使用type="text/javascript"
虽然它是默认值而不是必需的,你可以使用<script>...</script>
。
答案 1 :(得分:0)
更改
<script text="text/javascript">
到
<script type="text/javascript">
它是type=
而不是text=