plusnplus Posted June 3, 2010 Share Posted June 3, 2010 Hi.., I have a loop in javascript, i want to play sound each time the loop start. my html code is: <embed src="sound12.wav" autostart=false width=0 height=0 name="sound1" enablejavascript="true" HIDDEN="TRUE"> my javascript code: for (var i = 0; i < str_code; i++) { // do something EvalSound('sound1'); } edit: the sound only play once, even the loop is 10 times thanks for any reply/ help Link to comment https://forums.phpfreaks.com/topic/203731-how-to-play-sound-repeatedly-in-javascript/ Share on other sites More sharing options...
prestonwinfrey Posted June 3, 2010 Share Posted June 3, 2010 You could just add loop="true" to your embed tag. Link to comment https://forums.phpfreaks.com/topic/203731-how-to-play-sound-repeatedly-in-javascript/#findComment-1067188 Share on other sites More sharing options...
prestonwinfrey Posted June 3, 2010 Share Posted June 3, 2010 I just wanted to add that you can substitute a number for a boolean in the loop attribute of the embed tag. So you would add loop="3" to the embed tag if you wanted the sound to loop through three times. Link to comment https://forums.phpfreaks.com/topic/203731-how-to-play-sound-repeatedly-in-javascript/#findComment-1067189 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.