Jump to content

Trying To Make A Browser Juke Box


mrmagoo8870

Recommended Posts

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!

Link to comment
Share on other sites

  • 2 weeks later...

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!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...