HTML Code:
<!DOCTYPE html><!-- Declaration of the document type as HTML -->
<html>
<head>
<meta charset="utf-8"><!-- Meta tag specifying character encoding -->
<title> How to define the result of a calculation</title><!-- Title of the HTML document -->
</head>
<body>
<form <!-- Start of form element -->
oninput="w3resource.value=parseInt <!-- JavaScript code to execute when input changes -->
(input.value)+parseInt <!-- Parse input value as integer -->
(output.value)">0 <!-- Initial value -->
<input type="range" id="input" <!-- Input field for range selection -->
value="100">100 <!-- Default range value -->
+<input type="number" id="output" <!-- Input field for number -->
value="10"><!-- Default number value -->
=<output name="w3resource" <!-- Output field for displaying result -->
for="input output"></output><!-- Associated inputs for the output -->
</form><!-- End of form element -->
</body>
</html>
Explanation:
Live Demo:
See the Pen output-answer by w3resource (@w3resource) on CodePen.
See the solution in the browser
Supported browser
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4