Javascript Reference - HTML DOM Parameter value Property








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

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

Browser Support

value Yes Yes Yes Yes Yes

Syntax

Return the value property.

var v = parameterObject.value

Set the value property.

parameterObject.value=value




Property Values

Value Description
value Specifies the value of the parameter

Return Value

A String type value representing the value of the parameter.

Example

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


<!DOCTYPE html>
<html>
<body>
<!--   ww w .  j  a  v a 2  s  .  com-->
<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").value;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

The code above is rendered as follows: