In: Computer Science
NOTE: For this assignment, you will make two HTML pages.
<!doctype html> <html> <head> <meta charset="UTF-8"> <title>Number Check</title> <script type="text/javascript"> /* <![CDATA[ */ function checkTheNumber() { var num = document.getElementById("theNumber").value; var msg = ""; if (num >= 100) msg = msg + "The number is greater than "; msg = msg + "or equal to 100."; alert(msg); } /* ]]> */ </script> </head> <body> <h3>Number Checker</h3> <form action="NumberCheck.html" method="post" name="theForm" onsubmit="checkTheNumber(); return false;"> Enter a number: <input type="text" name="theNumber" id="theNumber" /> <br /> <br /> <input type="submit" value="Check the Number" /> </form> </body> </html>
Part 2:
Secondly, highlight, copy, and paste the following code into a new file in your editor, and save it as AreaCodes.html.
<!doctype html> <html> <head> <meta charset="UTF-8"> <title>Number Check</title> <script type="text/javascript"> /* <![CDATA[ */ function checkTheNumber() { var num = document.getElementById("theNumber").value; var msg = ""; if (num >= 100) msg = msg + "The number is greater than "; msg = msg + "or equal to 100."; alert(msg); } /* ]]> */ </script> </head> <body> <h3>Number Checker</h3> <form action="NumberCheck.html" method="post" name="theForm" onsubmit="checkTheNumber(); return false;"> Enter a number: <input type="text" name="theNumber" id="theNumber" /> <br /> <br /> <input type="submit" value="Check the Number" /> </form> </body> </html>
Add two hypertext links to the index.html file that is in your class folder. Make each of these hypertext links display one of the two HTML pages that you made for this assignment.
NOTE: The CODE provided for the AreaCode.html is just a replica of previous code. Kindly provide the proper prode for that to complete 2nd task
Here is the structure of the files.
├── Class
│ ├── AreaCodes.html
│ └── NumberCheck.html
└── index.html
Code for NumberCheck.html:
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Number Check</title>
<script type="text/javascript">
/* <![CDATA[ */
function checkTheNumber()
{
var num = document.getElementById("theNumber").value;
var msg = "";
if (num >= 100)
msg = "The number is greater than 100";
else
msg = "The number is less than 100";
alert(msg);
}
/* ]]> */
</script>
</head>
<body>
<h3>Number Checker</h3>
<form action="NumberCheck.html" method="post" name="theForm"
onsubmit="checkTheNumber(); return false;">
Enter a number: <input type="text" name="theNumber" id="theNumber" />
<br />
<br />
<input type="submit" value="Check the Number" />
</form>
</body>
</html>
Code for index.html
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Main</title>
</head>
<body>
<div>
<a href="/Class/AreaCodes.html">Area Code</a>
<a href="/Class/NumberCheck.html">Number Check</a>
</div>
</body>
</html>
Code for AreaCode.html (needs to be updated in question itself) Nothing related to area is mentioned/asked already in the code. Kindly update it.
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Number Check</title>
<script type="text/javascript">
/* <![CDATA[ */
function checkTheNumber()
{
var num = document.getElementById("theNumber").value;
var msg = "";
if (num >= 100)
msg = "The number is greater than 100";
else
msg = "The number is less than 100";
alert(msg);
}
/* ]]> */
</script>
</head>
<body>
<h3>Number Checker</h3>
<form action="NumberCheck.html" method="post" name="theForm"
onsubmit="checkTheNumber(); return false;">
Enter a number: <input type="text" name="theNumber" id="theNumber" />
<br />
<br />
<input type="submit" value="Check the Number" />
</form>
</body>
</html>