Javascript examples for DOM HTML Element:Object
You can create an <object> element by using the document.createElement() method:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">create an OBJECT element with an embedded flash file</button> <script> 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"); document.body.appendChild(x); } </script> </body> </html>