Meter max Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Meter

Description

The max property sets or gets the max attribute in a gauge.

The max attribute sets the upper bound of the gauge, and the value must be greater than the min attribute value.

Set the max property with the following Values

Value Description
number Sets a floating point number that is the maximum value of the gauge. Default value is "1"

Return Value

A Number, representing a floating point number that is the maximum value of the gauge

The following code shows how to change the value of the max attribute in a gauge:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<meter id="myMeter" min="0" low="40" high="75" max="100" value="65"></meter>

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

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

<script>
function myFunction() {//from   w w  w  . ja  va  2 s .  c  o  m
    document.getElementById("myMeter").max = "80";
    document.getElementById("demo").innerHTML = "The value of the max attribute was changed from '100' to '80'.";
}
</script>
</body>
</html>

Related Tutorials