I'm new to javascript and I have done a good amount of research on my problem with no luck. Any suggestions would be awesome. Additionally, would the math.random method be an appropriate approach to implement a way to play a random song from my playlist?
<!DOCTYPE HTML>
<html>
<head>
<title>Audio</title>
</head>
<body>
<script>
function play(){
var audio = document.getElementById("audio");
audio.play();
}
function stop(){
//var audio = document.getElementById("audio");
audio.stop();
}
function pause(){
var audio = document.getElementById("audio");
audio.pause();
}
</script>
<input type="button" value="PLAY" onclick="play()">
<input type="button" value="STOP" onclick="stop()">
<input type="button" value="PAUSE" onclick="pause()">
<audio id="audio" src="i_am.mp3" ></audio>
<audio id="audio" src="311.mp3" ></audio>
<audio id="audio" src="thievery_corporation.mp3" ></audio>
<audio id="audio" src="saxy.mp3" ></audio>
<audio id="audio" src="silent_rider.mp3" ></audio>
</body>
</html>
Aucun commentaire:
Enregistrer un commentaire