mrmagoo8870 0 Posted April 1, 2009 Report Share Posted April 1, 2009 Hello all,I have been looking for a way to use <embed>, <bgsound> or <object> to creat a browser juke box player that will allow the most comon browsers to use it and I'd like it to be able to play multiple .mid, .wav, and .mp3 files by selecting their choice. I've found nothing that works properly in all browsers. For MSIE I used <bgsound> and used a JavaScript and a <form> with buttons to change the src="file.wav" and stop the sound. I can't seem to figure out how to change the src of <embed> and I'm completely lost on <object>. Right now I simply have 5 <embed>'s on my page and it doesn't feel right, but I understand that it at least works in the majority of browsers. The page is: http://www.realmodyssey.com/bgmusic.htmlAny help would be greatly apreciated. Thanks! Quote Link to post Share on other sites
mrmagoo8870 0 Posted April 12, 2009 Author Report Share Posted April 12, 2009 (edited) Well, no replys so I went back and brushed up on the HTML DOM, namely the 'getElementById()' and 'innerHTML' properties. I believe I can do something like this. <html><head><title> dHTML Browser Jukebox </title><script type="text/javascript"><!--var name;function change(name) { document.getElementById('music').innerHTML="<a href='" + name + "' title='Click here to play in your Media Player. Right click here to save the file to your computer.'>" + name + "</a><br /><embed src=" + name + " autostart='true' loop='false' height='50px' />"; }//--></script></head><body onload="change('song1.mp3')"><a href="#" onclick=change('song1.mp3');>Song1</a> | <a href="#" onclick=change('song2.mp3');>Song2</a> | <a href="#" onclick=change('song3.mp3');>Song3</a> | <a href="#" onclick=change('song4.mp3');>Song4</a> | <a href="#" onclick=change('song5.mp3');>Song5</a><br /><br /><div id="music"></div></body></html> Edited to fix the code and to tel y'all I did the above and it works! Edited April 12, 2009 by MrMagoo Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.