Hello guys!
How are ya’ll doing?
I need some help on JavaScript.
I want to place a Widows Media player on my web site. Also I have a drop down menu with the songs people can listen to. What I need is when you select something from drop down menu it’s value is automatically added to players value so it plays the selected song.
I’ve got the following javascript
:
[code:1:4fc3a405be]
<script>
function Init(){
MP=document.WinMedia;
MP.Stop();
}
function DrawList(){
eval(Playlist.document.body.innerHTML);
channels=channels.split(",");
if(channels.length>0){
Tmp="<select name="channel" onChange="MStop();" id="M" style="width:115px;">";
for(i=0;i<channels.length;i++){
Tmp+="<option value=""+i+"">"+channels[i]+"</option>";
}
Tmp+="</select>";
}
else Tmp="<b>loaded</b>";
document.getElementById("List").innerHTML=Tmp;
}
function MPlay(){
MP.filename="VALUE OF A SELECTION HERE"+document.getElementById("channel").value; <-- VALUE HERE.
MP.Play();
}
function MStop(){
MP.Stop();
}
</script>
[/code:1:4fc3a405be]
I also have this drop down menu:
[code:1:4fc3a405be]
<select size="1" name="channel">
<option value =" http://mysong.mp3">MySong</option>
<option value ="http://mysong1.mp3">MySong1</option>
<option value =" http://mysong2.mp3">MySong2</option>
<option value =" http://mysong3.mp3" selected>MySong3</option>
</select>
[/code:1:4fc3a405be]
The question is, how do I make the value of selection to be added to JS?
Here you can see the player, drop down menu, play & stop buttons, player.
http://internet.cv.ua/chat/radio.php
Thanks for your help.
I appreciate it really much.