开发者

Where is the syntax error in this bit of JavaScript?

Error from firebug:

missing ) after condition
[Break on this error] else if (($(this).parent...nt().hasClass('plaing')==true) ) {

The code:

$(".myButtonPlay").live('click',function(){
     if ($(this).parent().parent().hasClass('current')==false){  

       console.log($(this).children().attr('src'));
       var media=$(this).parent().parent().attr('media');
       var id=$(this).parent().parent().attr('id');
       $(this).parent().parent().addClass('plaing');

       $(this).find('img').attr('src','开发者_如何转开发http://localhost:8000/silver/images/btn_pause.gif')
       play_media(media, id);


            }
      else if (($(this).parent().parent().hasClass('current')==true) $$ ($(this).parent().parent().hasClass('plaing')==true) ) {   
     $(this).parent().parent().removeClass('plaing');
      $('#mediaPlayer').attr('player').pause();
      $(this).find('img').attr('src','http://localhost:8000/silver/images/btn_pause.gif');

          }
     else  if ( ($(this).parent().parent().hasClass('current')==true) $$ ($(this).parent().parent().hasClass('plaing')==false)  ){    
     $(this).find('img').attr('src','http://localhost:8000/silver/images/btn_paly.gif');
     $(this).parent().parent().addClass('plaing');
     $('#mediaPlayer').attr('player').play();

         }

});

Where is the problem? Looks like error is in conditions of second if statement....


Unless I'm missing something, $$ is not an operator... maybe you meant &&?


$$ is not a valid operator. Reading your code it seems like you were trying to use the && operator.


JSLint is your friend, or at least it want's to be.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜