Latest web development tutorials
 

Object name Property

< Object Object

Example

Get the name of an <object> element:

var x = document.getElementById("myObject").name;

The result of x will be:

obj1
Try it Yourself »

More "Try it Yourself" examples below.


Definition and Usage

The name property sets or returns the value of the name attribute of an <object> element.

The name attribute specifies the name of an object.


Browser Support

Property
name Yes Yes Yes Yes Yes

Syntax

Return the name property:

objObject.name

Set the name property:

objObject.name=name

Property Values

Value Description
name Specifies the name of the <object> element

Technical Details

Return Value: A String, representing the name of the <object> element

Examples

More Examples

Example

Change the name of an <object> element:

document.getElementById("myObject").name = "newObjName";
Try it Yourself »

Related Pages

HTML reference: HTML <object> name attribute


< Object Object