Javascript DOM HTML Parameter name Property get

Introduction

Get the name of a <param> element:

var x = document.getElementById("myParam").name

Click the button to get the value of the name attribute of the parameter.

View in separate window

<!DOCTYPE html>
<html>
<body>

<object data="video.mp4">
  <param id="myParam" name="autoplay" value="true">
</object>//www.j  a va  2s  . c  om
<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 name property sets or gets the value of the name attribute of a parameter.

The name attribute sets the name of a <param> element.

This attribute works together with the value attribute to set parameters for the plugin for the <object> tag.

The name attribute value can be any name supported by the specified object.

The name property accepts and returns a String type value.




PreviousNext

Related