我有这个脚本:
function slideSwitch() {
var ae = jQuery('#featured-right a.active');
if ( ae.length == 0 ) {
ae = jQuery('#featured-right a:first');
var i = jQuery('#featured-right a').index(ae);
var bae = jQuery('#featured-left a.fb-'+i);
bae.show();
}
var ne = ae.next().length ? ae.next() : jQuery('#featured-right a:first');
}
$(document).ready(function(){
var ae = jQuery('#featured-right a.active');
if ( ae.length == 0 ) {
ae = jQuery('#featured-right a:first');
ae.addClass('active');
var i = jQuery('#featured-right a').index(ae);
jQuery('#featured-left a.fb-'+i).show();
jQuery('#featured-right a:not(.active) span.key').hide();
}
setInterval("slideSwitch()", 1000);
});它在除IE以外的任何浏览器上都能很好地工作。在IE上,IU get
SCRIPT1014: Invalid character featured.js, line 1 character 1这里出了什么问题?
发布于 2011-06-07 15:46:37
IE似乎不喜欢我在没有HTTP服务器的情况下访问页面的事实:)我访问的是c:\www\my-file。访问http://localhost/my-file时..效果很好。
发布于 2012-10-23 04:23:09
我也有同样的问题。它说在主文件的第一行第一行有一个错误。我在我使用的页面中使用了大量的AJAX。
这一切都归结为我在A标签上有onclick="#"这一事实。一旦我删除了它,错误就消失了。
我认为当jQuery通过AJAX调用加载html时,它会获取onclick标记并处理它在其中找到的javascript。
发布于 2018-02-22 22:55:47
注意模板字符串文字。此错误是由
`我在IE11中的角色。
https://stackoverflow.com/questions/6261256
复制相似问题