Create an Object Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Object


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

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<button onclick="myFunction()">create an OBJECT element with an embedded flash file</button>

function myFunction() {//from  www  .j  a va  2  s . c om
    var x = document.createElement("OBJECT");
    x.setAttribute("data", "helloworld.swf");
    x.setAttribute("width", "400");
    x.setAttribute("height", "400");


Related Tutorials