The optimum
attribute in the meter element
specifies the optimal range value.
The optimum
property sets or gets the value of the optimum attribute in a gauge.
optimum |
Yes | No | Yes | Yes | Yes |
Return the optimum property.
var v = meterObject.optimum
Set the optimum property.
meterObject.optimum=number
Value | Description |
---|---|
number | Set the optimal value of the gauge |
A Number type value representing the optimal value of the gauge.
The following code shows how to change the optimum attribute in a gauge.
<!DOCTYPE html>
<html>
<body>
<meter id="myMeter" value="0.3" high="0.9" low="0.1" optimum="0.5"></meter>
<button onclick="myFunction()">test</button>
<script>
function myFunction() {<!--from w ww . ja v a 2s. com-->
document.getElementById("myMeter").optimum = "0.7";
}
</script>
</body>
</html>
The code above is rendered as follows:
The following code shows how to get the optimum attribute in a gauge.
<!DOCTYPE html>
<html>
<body>
<meter id="myMeter" value="0.3" high="0.9" low="0.1" optimum="0.5"></meter>
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<!-- www .ja v a 2 s. co m-->
<script>
function myFunction() {
var x = document.getElementById("myMeter").optimum;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>
The code above is rendered as follows: