我想要一個帶有文本框和按鈕旁邊的按鈕的網站,可以背對背地播放某些mp3文件。HTML按鈕播放連續的MP3文件
假設我有一堆mp3文件與html文件存儲在同一目錄中。
如果在文本框中我寫了'hello there',我點擊了它旁邊的按鈕,程序會查找文件'hello.mp3'和'there.mp3',網站會播放這兩個文件背靠背。
在這一點上,我並不關心程序如何分割輸入中的單詞以查找帶有這些分隔的單詞的文件,但我更關心如何將兩個音頻文件播放回回到HTML。
例如:
<!DOCTYPE html>
<html>
<head>
<title> Play Sound from Text Input </title>
<script>
function play(){
<audio>
<source src='hello.mp3'>
<source src='there.mp3'>
</audio>
}
</script>
</head>
<body>
<input type='text'>
<input type="button" value="PLAY" onclick="play()">
</body>
</html>
您可以發佈您的代碼?你試過什麼了? – styfle
@styfle承認,完成 – user604803