SquareRoots / index.html
Codingrocks3's picture
Update index.html
7f828eb
raw
history blame contribute delete
765 Bytes
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<h1>Square Roots</h1>
<p>Drag the slider to display the square root.</p>
<div class="slidecontainer">
<input type="range" min="1" max="100" value="50" class="slider" id="myRange">
<p>Square root of <span id="PickedNumber"></span> is <span id="demo"></span></p>
</div>
<script>
var slider = document.getElementById("myRange");
var output = document.getElementById("demo");
var output2 = document.getElementById("PickedNumber");
output.innerHTML = Math.sqrt(slider.value);
output2.innerHTML = slider.value;
slider.oninput = function() {
output.innerHTML = Math.sqrt(this.value) ;
output2.innerHTML = this.value;
}
</script>
</body>
</html>