Random sound player

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
Parody
Forum Contributor
Posts: 252
Joined: Fri May 06, 2005 7:06 pm
Location: Great Britain

Random sound player

Post 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?
Post Reply