08/11/2012, 12:33
|
| | Fecha de Ingreso: julio-2012
Mensajes: 106
Antigüedad: 12 años, 4 meses Puntos: 2 | |
reproductor de musica ola quiero hacer un reproductor de musica y que al pinchar en un boton suene la cancion que se llama igual que el boton este es el codigo que estoy utilizando:
<script>
function elegirCancion(cancion)
{
switch (miAudio){
case "1":
document.getElementById("miAudio").src="audio/What You Want.mp3";
break;
case "2":
document.getElementById("miAudio").src="audio/Made of Stone.mp3";
break;
case "The Change":
document.getElementById("miAudio").src="audio/The Change.mp3";
break;
case "My Heart is Broken":
document.getElementById("miAudio").src="audio/My Heart is Broken.mp3";
break;
case "The Other Side":
document.getElementById("miAudio").src="audio/The Other Side.mp3";
break;
case "Erase This":
document.getElementById("miAudio").src="audio/Erase This.mp3";
break;
case "Lost in Paradise":
document.getElementById("miAudio").src="audio/Lost in Paradise.mp3";
break;
case "Sick":
document.getElementById("miAudio").src="audio/Sick.mp3";
break;
case "End of the Dream":
document.getElementById("miAudio").src="audio/End of the Dream.mp3";
break;
case "Oceans":
document.getElementById("miAudio").src="audio/Oceans.mp3";
break;
case "Never Go Back":
document.getElementById("miAudio").src="audio/Never Go Back.mp3";
break;
case "Swimming Home":
document.getElementById("miAudio").src="audio/Swimming Home.mp3";
break;
case "New Way To Bleed":
document.getElementById("miAudio").src="audio/New Way To Bleed.mp3";
break;
case "Say you will":
document.getElementById("miAudio").src="audio/Say you will.mp3";
break;
case "Disappear":
document.getElementById("miAudio").src="audio/Disappear.mp3";
break;
case "Secret Door":
document.getElementById("miAudio").src="audio/Secret Door.mp3";
break;
}
}
function play()
{
var oAudio=document.getElementById("miAudio");
}
</script>
<body>
<audio id="miAudio">
<source src="audio/What You Want.mp3" type="audio/mpeg" />
<source src="audio/Made of Stone.mp3" type="audio/mpeg" />
<source src="audio/The Change.mp3" type="audio/mpeg" />
<source src="audio/My Heart is Broken.mp3" type="audio/mpeg" />
...
</audio>
<input type="button" id="What You Want" name="pagina2.html" value="What You Want" onclick="elegirCancion(this.id) " /><br />
<input type="button" id="Made of Stone" name="pagina3.html" value="Made of Stone" onclick="elegirCancion(this.id) " /><br />
<input type="button" id="The Change" name="pagina4.html" value="The Change" onclick="elegirCancion(this.id) " /><br />
</body>
por que no funciona? muxas gracias de antemano al que me ayude |