Question

In: Computer Science

NOTE: For this assignment, you will make two HTML pages. First, highlight and copy the following...

NOTE: For this assignment, you will make two HTML pages.

  1. First, highlight and copy the following code, paste it into your editor, and save the document as 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 = 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>
  • Identify the bug that is in the page NumberCheck.html, and fix it. [HINT: Enter a number that is LESS THAN 100. The alerted message will be incomplete, because of the bug.] After you fix the bug, reload the page and test the page again. Make sure the message is correct, based on the number that you enter. ("Correct", for now, will mean that the alert message will be empty for numbers less than 100.)
  • Now add an else statement to the if statement in NumberCheck.html, which puts the string The number is less than 100. into the msg variable if the num variable is less than 100. After you add these lines of code, reload the page and test the page again. You should see a complete alert message for any number that you enter, now.

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.

  • Currently, AreaCodes.html is not displaying the correct area code for a city. Identify the bug, and fix it.
  • Now modify the switch statement above so that a default value of "You did not select a city." displays if none of the case labels match the areaCode variable.

Solutions

Expert Solution

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>

Related Solutions

take the following html code and make it work for html validator. heres the ,html file...
take the following html code and make it work for html validator. heres the ,html file <!DOCTYPE html> <html lang="en">    <head>        <title> GettingStarted</title>        <meta charset="utf-8">        <link href="Style.css" rel="stylesheet">    </head>       <body>        <header><h1>GettingStarted</h1></header>        <nav>               <b>        <a href="Home.html">Home</a>&nbsp;        <a href="GettingStarted.html">Getting Started</a>&nbsp;        <a href="MaterialsNeeded.html">Materials Needed</a>&nbsp;                      <a href="TroubleShooting.html">TroubleShooting</a>&nbsp;        <a href="InfoMaterials.html">Infomation on materials</a>&nbsp;   ...
This assignment is about using attributes in HTML. The attributes you will use for this assignment...
This assignment is about using attributes in HTML. The attributes you will use for this assignment include the lang attribute, the type attribute, and the start attribute. For this assignment, you will write an HTML document to create a web page that contains ordered lists with numbers, uppercase letters, lowercase letters, uppercase Roman numerals, and lowercase Roman numerals; and a list with lowercase Roman numerals that starts at a value other than 1. Your document can be about any topic...
For this assignment, you will write a tic-tac-toe application in HTML and JavaScript, using an HTML...
For this assignment, you will write a tic-tac-toe application in HTML and JavaScript, using an HTML <canvas> tag. The game will be played "hot seat" where players take turns using the same device. Requirements: The canvas should be 600px tall and wide, with the gameplay area occupying most of the canvas. The X's and O's may be drawn using polygons or large-font text The grid should be drawn using polygons, specifically long, thin rectangles Before & between games, the canvas...
Please note that this assignment consists of two separate parts. The first part gives the cash...
Please note that this assignment consists of two separate parts. The first part gives the cash flows for two mutually exclusive projects and is not related to the second part. The second part is a capital budgeting scenario. Part 1 Please calculate the payback period, IRR, MIRR, NPV, and PI for the following two mutually exclusive projects. The required rate of return is 15% and the target payback is 4 years. Explain which project is preferable under each of the...
write a detailed note on "Quality of education in comparative perspective". Note: two pages alteast
write a detailed note on "Quality of education in comparative perspective". Note: two pages alteast
Question 1 Note: Part 3 has 2 questions make sure you copy both questions from this...
Question 1 Note: Part 3 has 2 questions make sure you copy both questions from this page. Practical Questions (H) Question 1: Statement of Cash Flows   The following summarised information from Lumberjack Spratt Ltd is provided Lumberjack Spratt Ltd Summarised Comparative Statement of Financial Position as at 30 June 2018 2018 2017 $ $ Cash           931,301               437,807 Receivables           315,715               111,840 Allowance for Doubtful Debts              (6,315)                  (2,237) Interest Receivable                6,524                   6,524 Inventory           503,280               335,520 Office Supplies             15,844                   8,854 Prepaid Insurance             10,485...
The following HTML tags will be used to complete assignment below: · <table> · <tr> ·...
The following HTML tags will be used to complete assignment below: · <table> · <tr> · <td> Explore CSS and the various ways attributes can be manipulated to change the width and style of table borders in addition to the physical dimensions of the space that resides within each cell. Demonstrate mastery of the concepts of "absolute" vs. "relative" sizes when specifying table dimensions and create a traditional 12x12 multiplication table and a different HTML table on the same markup...
write a detailed note on "Teaching methadology in different countries"(minimum 5) Note: two pages alteast
write a detailed note on "Teaching methadology in different countries"(minimum 5) Note: two pages alteast
Just one to two pages to be written for this second assignment. Internal controls are an...
Just one to two pages to be written for this second assignment. Internal controls are an important tool to control theft, absences, fraud, embezzlement and other internal issues. Write an internal controls memo that will satisfy the AICPA ( Articles of Professional Conduct) standards that will be published and sent to all employees of your company.
For this assignment you need to create a ToDo list using Javascript, along with HTML and...
For this assignment you need to create a ToDo list using Javascript, along with HTML and CSS. Begin by creating a HTML page called todo.html. Then create a Javascript file called todo.js and link it in to the HTML page using a script tag. All Javascript for the assignment must be in the separate file. (For CSS, feel free to include styles in a style block at the top of the HTML page, or to link in CSS from a...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT