运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
转到 Spaces
<!DOCTYPE html> <html> <body> <p>Click the button to create an OBJECT and a PARAM element with an embedded audio file.</p> <button onclick="myFunction()">Try it</button> <script> function myFunction() { var x = document.createElement("OBJECT"); x.setAttribute("data", "horse.wav"); x.setAttribute("id", "myObject"); document.body.appendChild(x); var y = document.createElement("PARAM"); y.setAttribute("name", "autoplay"); y.setAttribute("value", "true"); document.getElementById("myObject").appendChild(y); } </script> </body> </html>