Uncaught SyntaxError: Unexpected token ILLEGAL [duplicate]

爷,独闯天下 提交于 2019-11-28 09:40:10

问题


Possible Duplicate:
Unexpected token ILLEGAL in webkit

I wrote a simple script for a hover over effect here http://jsfiddle.net/paDmg/368/ for this site http://avuedesigns.com/new/ - It works on jsfiddle, but I am getting

Uncaught SyntaxError: Unexpected token ILLEGAL

in my JavaScript when I put it live. It's on line 29 it is telling me which is the closing marks });​

$('#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);
});​

回答1:


You probably have embedded illegal characters. Look in your JS with a hex editor and look for any characters that aren't visible ASCII characters. They may be getting stripped off by JSfiddle

See Chrome Uncaught Syntax Error: Unexpected Token ILLEGAL



来源:https://stackoverflow.com/questions/12680072/uncaught-syntaxerror-unexpected-token-illegal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!