Javascript break breaks Firefox

Posted by Maxime on Stack Overflow See other posts from Stack Overflow or by Maxime
Published on 2010-06-05T23:48:10Z Indexed on 2010/06/05 23:52 UTC
Read the original article Hit count: 395

Filed under:
|
|

Hi,

I'm working on this Javascript script that works nice in Safari and Chome but for some reason it doesn't work at all in Firefox. I identified the line that caused this: it's "break;".

How do I fix this?

playListConfig( index );
$("#jquery_jplayer").jPlayer("play");


song_num = myPlayList[index].song_id;
if(!o[song_num]) { o[song_num] = 1;}

    $.get("http://www.ratemysong.net/includes/getnote.php?song_id="+song_num+"&s"+Math.random(), function(data){

        if(data == "")
        { 
            $('#rating ul li a').each(function() { $(this).attr('href', '#'); $(this).css("color","#FFF"); });  

            $('#rating ul li a').click(function(e) {
                ++o[song_num];

                if(o[song_num]==2)
                {
                    $(this).css({color:'#59B'});
                    var url = "http://www.ratemysong.net/boxes/voted.php?note=";
                    url = url + $(this).attr('id');
                    $.get(url, function(data){ $('#basic-modal-content').html(data); $("#basic-modal-content").modal(); });
                    rating[song_num] = $(this).attr('id');
                }

                else { $("#already_voted").modal(); }   

                break;
            });


        }
        else
        {
            $('#rating ul li a').each(function() {
                $(this).removeAttr('href');
                $(this).css("color","#000");
                var id_value = $(this).attr("id");
                $(this).css("color","#FFF");
                if(id_value == data) { $(this).css("color","#59B"); }
            });     
        }
    });
}

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about firefox