jQuery缺失;声明前
我对jQuery有一个问题,我的代码看起来不错,但我遇到了一个错误,听起来像这样: 失踪;声明前 [Break on this error]}elseif($('.v_gallery li:first').hasClass('s')){\n 我的代码如下所示: _gallery_pag:function(){jQuery缺失;声明前,jquery,Jquery,我对jQuery有一个问题,我的代码看起来不错,但我遇到了一个错误,听起来像这样: 失踪;声明前 [Break on this error]}elseif($('.v_gallery li:first').hasClass('s')){\n 我的代码如下所示: _gallery_pag:function(){ $('#top_pag a').live('click',function(){var_type=$(this.attr('rel') 我知道,可能我错过了拼写检查…因为我没有看到任何问题
$('#top_pag a').live('click',function(){var_type=$(this.attr('rel') 我知道,可能我错过了拼写检查…因为我没有看到任何问题
10个家伙你拼错了else-if。在else-if和if之间加一个空格。你拼错了else-if。在else-if和if之间加一个空格。在JavaScript中“elseif”不是关键字,应该是“else-if”你写的elseif不是“else-if”而不是“else-if”-在javascript中,这是两个不同的关键字 这是您的固定代码:
_gallery_pag : function() {
$('#top_pag a').live('click',function() { var _type = $(this).attr('rel');
switch(_type)
{
case '1':
if($('.v_gallery li:last').hasClass('s'))
{
$('.v_gallery li:first').find('a').click();
}else if($('.v_gallery li:first').hasClass('s')){
alert('You can\'t go back!You are at the first page!');
}
break;
}
return false;
});
}
您编写了elseif而不是“elseif”——在javascript中,这是两个不同的关键字 这是您的固定代码:
_gallery_pag : function() {
$('#top_pag a').live('click',function() { var _type = $(this).attr('rel');
switch(_type)
{
case '1':
if($('.v_gallery li:last').hasClass('s'))
{
$('.v_gallery li:first').find('a').click();
}else if($('.v_gallery li:first').hasClass('s')){
alert('You can\'t go back!You are at the first page!');
}
break;
}
return false;
});
}