Javascript examples for DOM HTML Element:Object
Object name Property - Change the name of an <object> element:
<!DOCTYPE html> <html> <body> <object id="myObject" width="250" height="200" data="helloworld.swf" name="obj1"></object> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*from w w w . j av a2s.co m*/ document.getElementById("myObject").name = "newObjName"; document.getElementById("demo").innerHTML = "The name of the object was changed from 'obj1' to 'newObjName'"; } </script> </body> </html>