Helpful Information
 
 
Category: General Coding
random music

i have my website so i can play music, one song. im trying to get it so it will play a different song everytime the page is loaded, or a set list of songs. however i would like the order to change everytime i refresh the page... i have not been able to accomplish this at all. if anyone can help, it would be greatly appreciated.

p.s. im using a javascript snippet that i found for this music, but i posted this here because there was other music stuff in the html post section. if you would like to move it, please do, i just didnt know where to post.


<script language="JavaScript"><!--
var soundFile = "http://webzoom.freewebs.com/ethix7664/jeremys****/music/Trogdor.mp3";if (soundFile.indexOf(",") > 0) {var sounds = soundFile.split(",");soundFile = sounds[Math.floor(Math.random()*sounds.length)];}if(navigator.plugins.length>0){
if (navigator.mimeTypes["audio/mp3"] && navigator.mimeTypes["audio/mp3"].enabledPlugin) document.write('<embed src="'+soundFile+'" autostart="true" loop="1" controls="SmallConsole" width=145 height=15></embed>');}
else {
document.write('<embed src="'+soundFile+'" autostart="true" loop="1" width=70 height=25></embed>');}

//-->
</script>
<noscript><embed src="http://webzoom.freewebs.com/ethix7664/jeremys****/music/Trogdor.mp3" autostart="true" loop="1"></embed></noscript>
<noembed><bgsound src="http://webzoom.freewebs.com/ethix7664/jeremys****/music/Trogdor.mp3" loop=1></noembed>
Thats what i have... that works fine. i would just like to add a few more songs to it, so i can play them randomly on refresh.

I might be wrong, but I think replacing the .mid files should work for wave format:



<SCRIPT LANGUAGE="JavaScript">
<!-- Javascripts resource by Hypergurl!! http://www.hypergurl.com -->
<!-- hide script. Begin
nummidi = 3
day = new Date()
z = day.getTime()
y = (z - (parseInt(z/1000,10) * 1000))/10
x = parseInt(y/100*nummidi,10) + 1
if (x == (1))
midi=("mid1.mid")
if (x == (2))
midi=("mid2.mid")
if (x == (3))
midi=("mid3.mid")
document.write('<EMBED SRC= ' + midi + ' autostart=true loop=true ')
document.write('volume=100 align="center" width=50 height=15 controls=smallconsole>')
// End -->
</SCRIPT>


Care of hypergurl javascripts

Hope this helps
cr3ative

thx cr3ative, i found a solution already, similar to yours, somewhat. haha, feel free to check it out, i modified the coding of most of it though, pretty sweet. at least i thought so. :) got it so it plays 3 random songs per day. a different band each day. ;) i enjoyed coding that one... fun stuff.

how does it work???? email me at ojn_bike246@hotmail.com :cool:

Hi, I have a website Back 2 The 50s with Elvis http://www.elvis-tcb.com/

Recently I have had to remove the Dynamic Drive script for embed and no embed that I have used with no problems for 2 years.

I received emails from viewers that had new Compaq XP's that the embedded music locked up their computer and they had to shut down. Temporarily I have replaced with <BGSOUND src=SONG loop=infinite> but it is so slow starting the song.

Is there a script that would allow <embed> music but detect if the computer was Compaq XP and switch them to <bgsound>
Thanks for any help,
John

Hi,

Did you get the random list solved? I'll help if you still haven't. Let me know.

Peace,

of music... :rolleyes:

Can someone tell me how to play ONE song in the background continuously throughout each web page?










privacy (GDPR)