HTML | DOM Output htmlFor Property
The HTML DOM Output htmlFor Property is used for returning the value of the for attribute of an <Output> Element. The htmlFor Attribute is used to specify the relationship between the result and the calculation.
Syntax:
outputObject.htmlFor
Parameter: This property does not accepts any parameter.
Return Value: It returns a element_id Which represents the relationship between the result and the calculation.
Example: This Example returns a htmlFor Property.
html
<!DOCTYPE html> < html > < head > < title > HTML DOM Output htmlFor Property </ title > < style > body { text-align: center; } h1 { color: green; } </ style > </ head > < body > < h1 >w3wiki</ h1 > < h2 > HTML DOM Output htmlFor Property </ h2 > < form oninput=" sumresult.value = parseInt (A.value) + parseInt(B.value) + parseInt(C.value)"> < input type="number" name="A" value="50" /> + < input type="range" name="B" value="0" /> + < input type="number" name="C" value="50" /> < br /> Submit Result: < output name="sumresult" id="Beginner" for="A B C"> </ output > < br > < br > </ form > < Button onclick="myBeginner()">Submit</ Button > < h2 id="sudo"></ h2 > < script > function myBeginner() { var x = document.getElementById("Beginner").htmlFor; document.getElementById("sudo").innerHTML = x; } </ script > </ body > </ html > |
Output:
- Before Clicking On Button:
- After Clicking On Button:
Supported Browsers: The browsers supported by HTML DOM Output htmlFor Property are listed below:
- Google Chrome 10.0
- Firefox 4.0
- Opera 11.0
- Safari 5.1
Contact Us