<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>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_param_create by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 03:08:04 GMT -->
</html>