Bookmark Topic Watch Topic
  • New Topic

Java and music files - please help  RSS feed

Fincoon Phan
Posts: 3
  • Mark post as helpful
  • send pies
  • Report post to moderator
I have this Java script for my website and it includes playing with music files. This code selects a random song from the list, but is there any way to make this shuffle a new song after it plays the current song? I would like the music to play the random music and somehow selects a new random song to play so that it plays continuously. Please help me with this as I have no knowledge in Java, but got this code source for music files. If you can, please edit the codes for the shuffling of music files. Thanks in advance.

var sound1="theme1.wma"
var sound2="theme2.wma"
var sound3="theme3.wma"
var sound4="theme4.wma"
var sound5="theme5.wma"
var sound6="theme6.wma"
var sound7="theme7.wma"
var sound8="theme8.wma"
var sound9="theme9.wma"
var sound10="theme10.wma"
var x=Math.round(Math.random()*9)
if (x==0) x=sound1
else if (x==1) x=sound2
else if (x==2) x=sound3
else if (x==3) x=sound4
else if (x==4) x=sound5
else if (x==5) x=sound6
else if (x==6) x=sound7
else if (x==7) x=sound8
else if (x==8) x=sound9
else x=sound10
if (navigator.appName=="Microsoft Internet Explorer")
document.write('<bgsound src='+'"'+x+'"'+' loop="infinite">')
document.write('<embed src='+'"'+x+'"'+'hidden="true" border="0" width="20" height="20" autostart="true" loop="true">')
Bear Bibeault
Author and ninkuma
Posts: 66263
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place.
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!