Javascript DOM HTML Parameter value Property get

Introduction

Get the value of a <param> element:

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

Click the button to return the value attribute of the parameter.

View in separate window

<!DOCTYPE html>
<html>
<body>

<object data="video.mp4">
  <param id="myParam" name="autoplay" value="true">
</object>/*from   w  w  w  .  j  a  v a2s.  c o m*/

<button onclick="myFunction()">Test</button>

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

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

</body>
</html>

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

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

This attribute works with the name attribute to set parameters for the plugin of the <object> tag.

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




PreviousNext

Related