我在IE7中得到一个错误,不知道是什么原因导致它?我在IE7(预期的标识符,字符串或数字)中得到一个脚本错误弹出窗口
错误的样子:
在这里看到的网站:http://www.wearewebstars.dk/frontend/Elevunivers/index.html
我在IE7中得到一个错误,不知道是什么原因导致它?我在IE7(预期的标识符,字符串或数字)中得到一个脚本错误弹出窗口
错误的样子:
在这里看到的网站:http://www.wearewebstars.dk/frontend/Elevunivers/index.html
IE抛出错误时,有最后一个对象后尾随逗号(见注释行)。 阅读更多在this answer in stackoverflow。
ui: {
tabs: function() {
$(".tabs-content div.tabpage").hide(); // Initially hide all content
$(".tabs li:first").attr("id","current"); // Activate first tab
$(".tabs-content div:first").fadeIn(); // Show first tab content
$('.tabs a').click(function(e) {
e.preventDefault();
var className = $(this).attr("name")
$(document).find(".tab-container").attr("class","grid_9 tab-container "+className);
if ($(this).closest("li").attr("id") == "current"){ //detection for current tab
return
}
else{
$(".tabs-content div.tabpage").hide(); //Hide all content
$(".tabs li").attr("id",""); //Reset id's
$(this).parent().attr("id","current"); // Activate this
$('#' + $(this).attr('name')).fadeIn(); // Show content for current tab
}
});
}, // <---------- THIS COMMA
}
如果你有IE8 +,你可以按F12带给开发者的工具,并检查控制台选项卡:
单击错误带你到哪个点你(这样的话)的脚本,其中行是。
P.S:比 其他,根据什么@ j08691在注释中说,加入meaninful代码到你的答案,以便其他人可以理解的错误,当他们搜索和查找您的问题编辑答案。
您确实需要升级到IE8 +并在IE7模式下运行该页面。原因是,浏览器的调试器会带你正确地处理错误。
在main.js
});
}, <-- the error is the trailing comma
}
}
// Initialize main script-Engine;
Engine.init();
});
删除逗号,它应该工作。
有一个致力于此错误的网站:http://trailingcomma.com/
什么是第55行? – tymeJV
它通常是#55 ...从我的经验 – mishik
您是否尝试过使用内置的开发人员工具来查看错误是什么? – J0HN