Create a Parameter Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Parameter


You can create a <param> element by using the document.createElement() method:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<button onclick="myFunction()">create an OBJECT and a PARAM element with an embedded audio file</button>

function myFunction() {/*from   w  w w  . j  ava2  s  . co  m*/
    var x = document.createElement("OBJECT");
    x.setAttribute("data", "your.wav");
    x.setAttribute("id", "myObject");

    var y = document.createElement("PARAM");
    y.setAttribute("name", "autoplay");
    y.setAttribute("value", "true");


Related Tutorials