HTML DOM Progress value Property
The Progress value Property in HTML DOM is used to set or return the value of the <progress> element. The value attribute is used to specify the completed task using a progress bar.
Syntax
It returns a value property.
progressObject.value
It sets the value property.
progressObject.value = number
Property Values: It contains a numeric value that represents the status of the completed task of the progress bar.
Return Value: It returns a Floating point number that specifies the status of the completed task of the Progress bar.
Example: Below code demonstrates how to display and set the value property.
HTML
<!DOCTYPE html> < html > < head > < title > HTML DOM Progress value Property </ title > </ head > < body > < center > < h1 style = "color:green;" > w3wiki </ h1 > < h2 >DOM Progress value Property </ h2 > Downloading progress for a song: < progress id = "GFG" value = "30" max = "100" > </ progress > < br >< br > < button onclick = "display()" > Display value </ button > < button onclick = "setvalue()" > setting value </ button > </ center > < script > function display() { var pr = document.getElementById("GFG").value; alert("The current status of progress Bar is:" + pr) } function setvalue() { var gf = document.getElementById("GFG").max = "50"; alert("The value of the progress Bar is:" + gf); } </ script > </ body > </ html > |
Output:
Supported Browsers:
- Google Chrome
- Internet Explorer
- Firefox
- Opera
- Apple Safari