Javascript DOM HTML Meter optimum Property set

Introduction

Change the value of the optimum attribute in a gauge:

document.getElementById("myMeter").optimum = "0.7";

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

View in separate window

<!DOCTYPE html>
<html>
<body>

<p>My scale: <meter id="myMeter" value="0.3" high="0.9" low="0.1" optimum="0.5"></meter></p>
<button onclick="myFunction()">Test</button>

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

<script>
function myFunction() {//from   ww w .  jav a 2s . c o m
  document.getElementById("myMeter").optimum = "0.7";
  document.getElementById("demo").innerHTML = "The value of the optimum attribute was changed.";
}
</script>

</body>
</html>



PreviousNext

Related