Javascript DOM HTML Meter max Property set

Introduction

Change the value of the max attribute in a gauge:

document.getElementById("myMeter").max = "80";

Click the button to change the value of the max attribute of the gauge.

View in separate window

<!DOCTYPE html>
<html>
<body>

<p>My scale: <meter id="myMeter" min="0" low="40" high="75" max="100" value="65"></meter></p>
<button onclick="myFunction()">Test</button>
<p id="demo"></p>

<script>
function myFunction() {//from  w  ww .j  a v  a2s.  c  o m
  document.getElementById("myMeter").max = "80";
  document.getElementById("demo").innerHTML = "The value of the max attribute was changed.";
}
</script>

</body>
</html>

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

The max attribute sets the upper bound of the gauge.

The value must be greater than the min attribute value.

If unspecified, the default value is 1.

The max property accepts and returns a number type value.




PreviousNext

Related