我有这样的脚本:SCRIPT1014:无效字符
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得到
SCRIPT1014: Invalid character featured.js, line 1 character 1
这里有什么问题?
离题,但与您的代码相关:您不应该将字符串传递给'setInterval'或'setTimeout'。改为传递一个函数。你的情况:'setInterval(slideSwitch,1000);',如果你需要传递参数:'setInterval(function(){/ *无论你想做什么,例如调用函数* /},1000);' – ThiefMaster 2011-06-07 06:19:51
谢谢为小费。 – 2011-06-07 06:27:40