The value
property sets or gets the value attribute in a gauge.
value |
Yes | No | Yes | Yes | Yes |
Return the value property.
var v = meterObject.value
Set the value property.
meterObject.value=number
Value | Description |
---|---|
number | Set a floating point number for the current value of the gauge |
A Number type value representing the current value of the gauge.
The following code shows how to get the value attribute in a gauge.
<!DOCTYPE html>
<html>
<body>
<meter id="myMeter" min="0" low="40" high="95" max="100" value="65"></meter>
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<script>
function myFunction() {<!-- w ww.j a va 2 s . c o m-->
var x = document.getElementById("myMeter").value;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>
The code above is rendered as follows:
The following code shows how to change the value attribute in a gauge.
<!DOCTYPE html>
<html>
<body>
<meter id="myMeter" min="0" low="40" high="95" max="100" value="65"></meter>
<!-- ww w. j av a 2 s.c om-->
<button onclick="myFunction()">test</button>
<script>
function myFunction() {
document.getElementById("myMeter").value = "50";
}
</script>
</body>
</html>
The code above is rendered as follows: