Meter max प्रॉपर्टी <meter> एलिमेंट के max एट्रिब्यूट से संबंधित संख्या को लौटाती या सेट करती है। बेहतर परिणाम के लिए इसे high, min और low एट्रिब्यूट के साथ उपयोग करें।
सिंटैक्स
निम्नलिखित सिंटैक्स है -
- max प्रॉपर्टी का मान प्राप्त करना
meterElementObject.max
- max प्रॉपर्टी का मान सेट करना
meterElementObject.max = number
उदाहरण
आइए Meter max प्रॉपर्टी का एक उदाहरण देखें -
<!DOCTYPE html> <html> <head> <title>Meter max</title> <style> form { width:70%; margin: 0 auto; text-align: center; } * { padding: 2px; margin:5px; } input[type="button"] { border-radius: 10px; } </style> </head> <body> <form> <fieldset> <legend>Meter-max</legend> <label for="paulaLifeSource">पौला का स्वास्थ्य जोखिम: </label> <meter id="paulaLifeSource" max="100" min="0" high="80" low="60" value="70"></meter> <input type="button" onclick="lifeSource()" value="Medi Kit"> <div id="divDisplay"></div> </fieldset> </form> <script> var divDisplay = document.getElementById("divDisplay"); divDisplay.textContent = 'Life Source at '+paulaLifeSource.value+'/'+paulaLifeSource.max; function lifeSource(){ var paulaLifeSource = document.getElementById("paulaLifeSource"); var Immunity = paulaLifeSource.max; paulaLifeSource.max = 80; divDisplay.textContent = 'Life Decreased to '+paulaLifeSource.max+' from '+Immunity; } </script> </body> </html>
आउटपुट
यह निम्नलिखित आउटपुट उत्पन्न करेगा -
'Medi Kit' बटन पर क्लिक करने से पहले -

'Medi Kit' बटन पर क्लिक करने के बाद -
