View Full Version : Using Javascript to play music..

05-25-2005, 08:48 PM
Hi is there a way to use javascript to display music.

I know that this is using html but Is it possible to have a drop down menu thing that will play a song like this thing does when you click on the one you want.
<center><embed src="URL of MEDIA" width="200" height="20"></center>
So far I have only seen one that uses "oleobject/application" or whatever and this does not work on macintosh computers.

05-25-2005, 09:15 PM
<embed> work tho eh?


link it to the drop down menu and on change run this function

function music(song){
var html = "<embed src='url/of/"+song+".wav' width='200' height='20'>"
// or you can use innerHTML
// var songArea = document.getElementById('divID');
// songArea.innerHTML = html;

ohh and the 'songArea' is

<div id="divID"></div>