Parameter name Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Parameter

Description

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

Set the name property with the following Values

Value Description
name Sets the name of the parameter

Return Value

A String, representing the name of the parameter

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

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<object data="horse.wav">
  <param id="myParam" name="autoplay" value="true">
</object>/*  w w  w  .j a va  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>

Related Tutorials