View Full Version : Play song that is selected in a dropdown menu

10-22-2005, 11:49 PM
Can someone please fix this script for me? I don't know what I did wrong. The script is supposed to play the song you select from the dropdown menu when you hit play, and stop when you hit the stop button. Here it is:

<script language="javascript">
var aySound = new array();
sound[1] = "test1.mp3";
sound[2] = "test2.mp3";
sound[3] = "test3.wma";
sound[4] = "test4.mp3";
sound[5] = "test5.mp3";
document.write('<BGSOUND ID="auIEContainer">')
IE = (navigator.appVersion.indexOf("MSIE")!=-1 && document.all)? 1:0;
NS = (navigator.appName=="Netscape" && navigator.plugins["LiveAudio"])? 1:0;
ver4 = IE||NS? 1:0;
function auPreload() {
if (!ver4) return;
if (NS) auEmb = new Layer(0,window);
else {
Str = "<DIV ID='auEmb' STYLE='position:absolute;'></DIV>";
var Str = '';
for (i=0;i<aySound.length;i++)
Str += "<EMBED SRC='"+aySound[i]+"' AUTOSTART='FALSE' HIDDEN='TRUE'>"
if (IE) auEmb.innerHTML = Str;
else {
auCon = IE? document.all.auIEContainer:auEmb;
auCon.control = auCtrl;
function auCtrl(whSound,play) {
if (IE) this.src = play? aySound[whSound]:'';
else eval("this.document.embeds[whSound]." + (play? "play()":"stop()"))
function playSound(whSound) { if (window.auCon) auCon.control(whSound,true); }
function stopSound(whSound) { if (window.auCon) auCon.control(whSound,false); }
<select name="song">
<option playSound(1)>Test1</option><option playSound(2)>Test2</option><option playSound(3)>Test3</option><option playSound(4)>Test4</option><option playSound(5)>Test5</option>
<br><input type=submit value="play">
<img src="stop.gif" onmousedown="stopsound()">

10-23-2005, 01:22 AM
Doesn't anybody know???????? PLEASE HELP MEEEE!!!!!!!!! :mad:

10-23-2005, 02:20 AM
why do they even make these forums, if no one ever responds? PLEASE HEEEELP!:mad: :confused: :mad:

10-23-2005, 02:37 AM
Lets see, first post 5:49pm, second post 7:22pm, third post 8:20pm. You haven't been patient at all. We aren't here 24/7. You would have found your answer on your own if you had just searched. There is a whole thread that deals with nothing but embedded media players some with playlists some without. Some with a drop down menu and some without. http://www.codingforums.com/showthread.php?p=367461

10-23-2005, 02:47 AM
sorry. I'm just used to other forums I use where there are people there 24/7. I'm new here