Javascript examples for DOM HTML Element:Object
The name property sets or gets the name attribute of an <object> element.
Set the name property with the following Values
Value | Description |
---|---|
name | Sets the name of the <object> element |
A String, representing the name of the <object> element
The following code shows how to get 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 ww w.j a va 2 s .c om*/ var v = document.getElementById("myObject").name ; document.getElementById("demo").innerHTML = v; } </script> </body> </html>