I'm having trouble figuring out why it's not working. I've searched online and here, but all I could find were tutorials that didn't include the variable or questions that were too specific.
Can someone help me with this?
<html>
<head>
<title>Test</title>
<script type="text/javascript">
function changeaudio(x);
{
document.getElementById("audioplayer").src=x+".mp3";
document.getElementById("image").src=x+".png";
}
</script>
</head>
<body>
<center>
<img id="image" src="1.png">
<audio id="audioplayer" src="1.mp3" controls autoplay loop>
Your browser does not support the audio element.
</audio>
<br>
<input type="button" id="play" value="Play 1" onclick='changeaudio(1)"' />
<input type="button" id="play2" value="Play 2" onclick='changeaudio(2)"' />
<input type="button" id="play3" value="Play 3" onclick='changeaudio(3)"' />
</center>
</body>
</html>