PDA

View Full Version : calling a js function twice on the same event



ajetrumpet
Jul 13th, 2009, 06:13 AM
hello all,

I am a new HTML programmer and I have a simple question...

I am using a small js script to play .wav files on my website, and I want to play multiple files in sequencial order by calling the same function twice, with a different argument both times. I am using this code:
<div id="apDiv44" onclick="EvalSound('ColorTop');EvalSound('Globe');EvalSound('Blue')"></div>I think i've got the separators correct, but for some reason, when I click my image, all of the .wav files are playing at the same time. could i please get some assistance? thank you very much...

udjamaflip
Jul 13th, 2009, 10:34 AM
Because it executes the script, and as there is no wait for execution it executes the next, you need to insert a break for each song or create some kind of playlist option if you wish to que them up.

if you want to set them all run at a certain length of time you could use setInterval, but you probably want some kind of media controller to detect when the song finishes.

hope that helps! :thumbsup:

ajetrumpet
Jul 13th, 2009, 12:42 PM
Because it executes the script, and as there is no wait for execution it executes the next, you need to insert a break for each song or create some kind of playlist option if you wish to que them up.

if you want to set them all run at a certain length of time you could use setInterval, but you probably want some kind of media controller to detect when the song finishes.

hope that helps! :thumbsup:Andrew,

I am familiar with the </br> tag, but I have never used it. I have googled the heck out of "HTML playlist" and any derevation thereof, and can't seem to hit anything. do you have any more information on your recommendations, or any recc's on the "detection" method you referred to? thanks!