2012-10-01 49 views
2

Possible Duplicate:
Unexpected token ILLEGAL in webkit未捕获的SyntaxError:意外的标记非法

我写了一个简单的脚本,针对一悬停在这里效力http://jsfiddle.net/paDmg/368/这个网站http://avuedesigns.com/new/ - 它的工作原理上的jsfiddle,但我在我的JavaScript越来越

Uncaught SyntaxError: Unexpected token ILLEGAL

当我把它生活。它在第29行告诉我哪个是结束标记});

$('#hover-grid .indiv-cell').hover(function() { 

//set variables to current cell attributes 
var cellHeader = $(this).attr('data-hoverheader'); 
var cellText = $(this).attr('data-hovertext'); 
var replacementImg = $(this).find('a img').attr('data-replacementimg'); 
var oringinalImg = $(this).find('a img').attr('src'); 

//save original image to data variable 
$(this).data('origImg', oringinalImg); 

//add remove classes 
$('#hover-grid .indiv-cell').removeClass('newClass'); 
$(this).addClass('newClass', 1000); 
$(this).find('a img').hide().attr('src', replacementImg).fadeIn(300); 
$('.master-cell h1').hide().text(cellHeader).fadeIn(300); 
$('.master-cell p').hide().text(cellText).fadeIn(300); 

//return false; 
}, function() { 
    $(this).find('a img').hide().attr('src', $(this).data('origImg')).fadeIn(10); 
});​ 
+2

检查您的JS像空无效嵌入的字符,这可能会通过的jsfiddle剥离。 –

+0

你的代码只有25行... – Christoph

+0

@Nadim Dayoub:FYI http://bugs.jquery.com/ticket/11731 – elclanrs

回答

6

您可能嵌入了非法字符。用十六进制编辑器查看JS,并查找任何不可见的ASCII字符。它们可以通过的jsfiddle

可以得到剥离见Chrome Uncaught Syntax Error: Unexpected Token ILLEGAL

+0

谢谢,删除最后一行并重新输入它,没有更多的错误。现在我要弄清楚为什么现在不工作... –

相关问题