I have a JavaScript that I found that picks out a music file at random and then plays it when the site is launched. Now, i was wondering if there's a way to alter the script and make it start a new song when one ends. That way the user don't have to refresh the page whenever the song ends.
This is the code:
<script>
var sound1="Music/AnythingGoes.mp3"
var sound2="Music/AWonderfulGuy.mp3"
var sound3="Music/BoogieMan.mp3"
var sound4="Music/ButcherPete.mp3"
var sound5="Music/Civilization.mp3"
var x=Math.round(Math.random()*4)
if (x==0) x=sound1
else if (x==1) x=sound2
else if (x==2) x=sound3
else if (x==3) x=sound4
else x=sound5
if (navigator.appName=="Microsoft Internet Explorer")
document.write('<bgsound src='+'"'+x+'"'+' loop="infinite">')
else
document.write('<embed src='+'"'+x+'"'+'hidden="true" border="0" width="0" height="0" autostart="true" loop="true">')
</script>
Aucun commentaire:
Enregistrer un commentaire