執行 ❯
建立您
自己的
網站
×
更改方向
儲存程式碼
更改主題,深色/淺色
轉到 Spaces
<!DOCTYPE html> <html> <body> <h3>A demonstration of how to access a SOURCE element</h3> <audio controls> <source id="mySource" src="horse.mp3" type="audio/mpeg"> <source src="horse.ogg" type="audio/ogg"> Your browser does not support the audio element. </audio> <p>Click the button to get the URL of the media file.</p> <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("mySource").src; document.getElementById("demo").innerHTML = x; } </script> </body> </html>