Javascript Reference - HTML DOM Parameter name Property








The name property sets or gets the value of the name attribute of a parameter.

The name attribute specifies the name of a <param> element and works together with the value attribute to specify parameters for the plugin specified with the <object> tag.

Browser Support

name Yes Yes Yes Yes Yes

Syntax

Return the name property.

var v = parameterObject.name 

Set the name property.

parameterObject.name=name




Property Values

Value Description
name Set the name of the parameter

Return Value

A String type value representing the name of the parameter.

Example

The following code shows how to get the name of a <param> element.


<!DOCTYPE html>
<html>
<body>
<!--from   w  ww.ja  va 2s  . c  o m-->
<object data="notExist.wav">
  <param id="myParam" name="autoplay" value="true">
</object>
<button onclick="myFunction()">test</button>

<p id="demo"></p>

<script>
function myFunction() {
    var x = document.getElementById("myParam").name;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

The code above is rendered as follows: