Click to See Complete Forum and Search --> : How to play music?


arthur
12-04-2003, 11:50 AM
Can someone lead to me tutorial or script that will play different songs depending on what button is pressed?

Thanks

fredmv
12-04-2003, 12:02 PM
http://www.webreference.com/javascript/960916/part02.html

arthur
12-04-2003, 02:31 PM
Thanks but ... this script uses Java AWT. Can I have a few songs play, 1 at a time, depending on a button or link?

arthur
12-04-2003, 02:34 PM
Also, if you try the example this tutorial gives you, you get an error.

fredmv
12-04-2003, 05:47 PM
That doesn't use Java AWT — it's JavaScript. Here's the simplest way of playing music using links/buttons:<embed src=""></embed>Then:<a href="#" onclick="document.embeds[0].src='1.mp3';">1.mp3</a> |
<a href="#" onclick="document.embeds[0].src='2.mp3';">2.mp3</a>Simply replace those filenames with the actual name of the song files you would like to be played.

arthur
12-05-2003, 08:17 AM
Thanks for your help. but I'm still not getting it. Below, the OBJECT code will play, but the link does nothing, even if I remove the OBJECT code. What am I doing wrong?

<body>

<OBJECT ID=apradio CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA"
HEIGHT=4 WIDTH=4 vspace="0">
<PARAM NAME="controls" VALUE="none">
<PARAM NAME="console" VALUE="Clip1">
<PARAM NAME="autostart" VALUE="TRUE">
<PARAM NAME="src" VALUE="file.mp3">
<PARAM NAME="type" VALUE="audio/x-pn-realaudio-plugin">
</OBJECT>

<embed src=""></embed>

<a href="#" onclick="document.embeds[0].src='file.mp3';">first</a>

</body>