Javascript DOM HTML Parameter Object get

Introduction

The Parameter object represents an HTML <param> element.

The <param> element can define parameters for plugins embedded with an <object> element.

We can access a <param> element via document.getElementById():

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

Click the button to get the name of the parameter.

View in separate window

<!DOCTYPE html>
<html>
<body>
<object data="video.mp4">
  <param id="myParam" name="autoplay" value="true">
</object>//from   ww  w. j a  v a 2 s.c o  m

<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>



PreviousNext

Related