javascript - Reset link background color on previously selected -


hi have song playlist & use javascript in player set ground color light green on playing song. aware use a:focus if user selects lyrics while song playing song continue play looses focus background color reverts original. need way use javascript change color of song original when song no longer playing or song selected. code below.

<!-- video player script -->   var video_playlist = document.getelementbyid("video_player"); var links = video_playlist.getelementsbytagname('a'); (var i=0; i<links.length; i++) {                      links[i].onclick = handler;                        };  function handler(e) {                                    e.preventdefault();          videotarget = this.getattribute("href");     filename = videotarget.substr(0, videotarget.lastindexof('.')) || videotarget;     video = document.queryselector("#video_player video");     source = document.queryselectorall("#video_player video source");     source[0].src = filename + ".mp3";     video.load();        video.play();        this.style.background = "#aaff8d";                   };       

if html5 video use onended proptery detect when video finishes playing:

video.onended = function(e) {   // change background color here }; 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -