36 lines
1.2 KiB
HTML
36 lines
1.2 KiB
HTML
|
<html>
|
||
|
<head>
|
||
|
<title>Example 7.18a</title>
|
||
|
<script type="text/javascript" src="mySource.js"></script>
|
||
|
<script>
|
||
|
function getRange()
|
||
|
{
|
||
|
var num1 = parseInt(prompt("Enter low end of the range"));
|
||
|
var num2 = parseInt(prompt("Enter the high end of the range"));
|
||
|
var num3 = parseInt(prompt("Enter the number to check"));
|
||
|
var answer = checkRange(num3, num1, num2);
|
||
|
document.getElementById("line1").innerHTML = ("low end: " + num1 + "<br />");
|
||
|
document.getElementById("line2").innerHTML = ("high end: " + num2 + "<br />");
|
||
|
document.getElementById("line3").innerHTML = ("number to be checked: " + num3 + "<br />");
|
||
|
if (answer)
|
||
|
document.getElementById("line4").innerHTML = ("Number is in range");
|
||
|
else
|
||
|
document.getElementById("line4").innerHTML = ("Number is NOT in range");
|
||
|
}
|
||
|
</script>
|
||
|
</head>
|
||
|
<body>
|
||
|
<table align ="center" width ="70%"><tr><td colspan ="2">
|
||
|
<h1> </h2>
|
||
|
<h1>Get Range Function</h1>
|
||
|
<h3>Click to check a range</h3>
|
||
|
<p><input type="button" id="range" value="Enter a range" onclick="getRange();" /></p>
|
||
|
<div id = "line1"> </div>
|
||
|
<div id = "line2"> </div>
|
||
|
<div id = "line3"> </div>
|
||
|
<div id = "line4"> </div>
|
||
|
</td></tr>
|
||
|
</table></body>
|
||
|
</html>
|
||
|
|