Tuesday, 15 July 2014

html5 - Javascript not executing functions using = operator -


I'm new to JavaScript, so this is a basic question I created a simple MP3 player that first loads the song , Then plays the next two songs in an array. I modified this code that I found on the stack, and it works:

  audio player.Nondend = function () (if (current sounds) Next Song.Lang-1 } {AudioPlayer.src = Next Song [++ currentSong]; Document.getElementById ('songTitle'). InnerHTML = songTitle [currentSong];}}  

However, if I implement my own I try to do the function and attempts to call the function the way it does not work:

  on the audio player D = Next Song (); Function Next Song (if (Current Song: Next Song: Lang-1) {audioPlayer.src = Next Song [++ Current Song]; Document.getElementById ('songTitle'). InnerHTML = songTitle [currentSong];}}  

Every time I want to use the function, I do not want to overwrite the code (Song) The next Song () function has tried to call, for example, but the function can not be found to call to help you Thanks.

It is a common misconception that your second example is actually doing what is next gen The function is running and its return value is being specified on onended .

Instead, you can change your code in the following:

Function Next Song () (If Current Song (Next Song) Next Song. AudioPlayer.src = Next Song [++ Current Song]; Document.getElementById ('songTitle'). InnerHTML = songTitle [currentSong]; }} // Assign the function (next song) its not return value (next song) audio player. Fixed = next song;

No comments:

Post a Comment