<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div>
<input type="number" placeholder="请输入时间">分钟 <br>
<input type="button" value="开始" ><br>
<input type="number">秒
</div>
<audio src="source/game_music.mp3" id="m"></audio>
</body>
</html>
<script>
const ipt = document.getElementsByTagName('input')
const music = document.getElementById('m')
ipt[1].onclick=function (){
ipt[2].value=ipt[0].value*60
time= setInterval(function () {
ipt[2].value=ipt[2].value-1
if (ipt[2].value==0){
clearInterval(time)
music.play()
}
},1000)
}
</script>