Page 1 of 1

Random sound player

Posted: Mon May 29, 2006 8:08 pm
by Parody
I am trying to make a button which when clicked plays a random sound of a selection of 10 using javascript. I have all the clicking and playing the sound working perfectly, but only when you manually enter which sound to play. The files are named from 1.mp3 to 10.mp3.

I currently use this:

Code: Select all

<embed src="1.mp3" autostart=false width=0 height=0 name="sound1"
enablejavascript="true">
to select the sound and was wondering if there is anyway to randomly change between each sound when the button is clicked?