Question

Examine the following code, which contains six common bugs. In a separate Microsoft Word (or other...

Examine the following code, which contains six common bugs. In a separate Microsoft Word (or other word processing or text file), identify the line number of at least three (3) bugs as well as a brief description of each bug. 1. 2.

1. <!DOCTYPE html>

2. </html>

3. <head> <link rel="stylesheet" href="MyStyle.css"> </head>

4. <body>

5. <nav>

6. <a href="GroceryHome.html">Home</a> |

7. <a href="Products.html">Products</a> |

8. <a href="AboutUs.html">About Us</a> |

9. <a href="Contact.html">Contact</a>

10. </nav>

11. <header>

12. <h1> My Contact Page</h1>

13. </header>

14. <article>

15. Thank you for your interest in our grocery store. We offer delivery or call-ahead pickup services.

Please provide your contact information, and indicate your family's food preferences.

16. </article> <p>

17. <form action="#" method="post" id="form1">

18. <div class="div1">

19. <label for="fname1" >First Name:</label><br>

20. <input type="text" name="firstname1" id="fname1"><br>

21. <label for="lname1" >Last Name:</label><br>

22. <input type="text" name="lastname1" id="lname1"><br>

23. <label for="phone1" >Phone (i.e. 123-456-7890):</label><br>

24. <input type="text" name="phone1" id="phone1" placeholder="123-456-7890" ><br>

25. <label for="email1" >Email:</label><br>

26. <input type="text" name="email1" id="email1" placeholder="abc@xyz"><br>

27. <label for="contactpreference1" >Prefered contact method?</label><br>

28. <input type="radio" name="contactpreference1" value="phone" checked> Phone

29. <input type="radio" name="contactpreference1" value="email"> Email

30. <br><br>

31. <input type="submit" id="Submit1" value="Submit" onclick=" validateMyPage()" />

32. </div>

33. </form>

34. <form action="#" method="post" id="form2" >

35. <div class="div2">

36. <label for="fname2" >First Name:</label><br>

37. <input type="text" name="firstname2 id="fname2" required><br>

38. <label for="lname2" >Last Name:</label><br>

39. <input type="text" name="lastname2" id="lname2" required><br>

40. <label for="phone2" >Phone (i.e. 123-456-7890):</label><br>

41. <input type="tel" name="phone2" id="phone2" placeholder="123-456-7890" pattern='\d{3}[\-

]\d{3}[\-]\d{4}' required><br>

42. <label for="email2" >Email:</label><br>

43. <input type="email" name="email2" id="email2" placeholder="[email protected]" required><br>

44. <label for="contactpreference2" >Prefered contact method?</label><br>

Week Two Assignment

PRG/280 Version 5

2

Copyright © 2017 by University of Phoenix. All rights reserved.

45. <input type="radio" name="contactpreference2" value="phone" checked> Phone

46. <input type="radio" name="contactpreference2" value="email"> Email

47. <br><br>

48. <input type="submit" id="Submit2" value="Submit" />

49. </div>

50. <br><br>

51. <div class="myColumns ">

52. <select id="mySiteColor" onChange="changeColor(this.value)">

53. <option value="">-- Select a color --</option>

54. <option value="blue">Blue</option>

55. <option value="yellow">Yellow</option>

56. <option value="red">Red</option>

57. </select>

58. </div>

59. </form>

60. <script>

61. function validateMyPage() {

62. var firstname1 = document.getElementById("fname1").value;

63. if (firstname1 != "") {

64. alert("Please enter a first name.");

65. }

66. else {

67. alert(firstname1);

68. }

69. var phone1 = document.getElementById("phone1").value;

70. if (phone1 == "") {

71. alert("Please enter a phone number.");

72. return false;

73. }

74. else

75. {

76. var rePhone = new RegExp(/\d{3}[\-]\d{3}[\-]\d{4}/);

77. var reResult = rePhone.test(phone1);

78. if (reResult == false)

79. {

80. alert("Please provide a valid phone number in the format of: 222-222-2222.");

81. return false;

82. }

83. else

84. {

85. alert(phone1);

86. }

87. }

88. var email1 = document.getElementById("email1")!value;

89. if (email1 == "") {

90. alert("Please enter an email address.");

91. return false;

92. }

93. else

94. {

95. var reEmail = new RegExp(/[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$/);

96. var reResult == reEmail.test(email1);

97. if (reResult == false)

98. {

99. alert("Please provide a valid email address.");

Week Two Assignment

PRG/280 Version 5

3

Copyright © 2017 by University of Phoenix. All rights reserved.

100. return false;

101. }

102. else

103. {

104. alert(“email1”);

105. }

106. }

107. alert("Form data validated by JavaScript successfully!");

108. }

109. function changeColor(value) {

a. var myColor = document.getElementById("mySiteColor").value;

b. document.body.style.color = value;

110. }

111. </script>

112. </body>

113. </html>

Homework Answers

Answer #1

Dear Student ,

As per the requirement submitted above , kindly find the below solution.

Line 2 :

  • on line 2 </html> closing html is given here it is required <html lang="en">

Line 63 :

  • 63. if (firstname1 != "") { Here instead of != . need to use == to check for empty.

Line 88:

  • var email1 = document.getElementById("email1")!value;
    • On line 88 that is in above line instead of .(dot) , !(explanation mark) is used.

Line 96 :

  • var reResult == reEmail.test(email1);
    • here need to use single = ,instead two ==.

Line :

Below code needs to be commented

Week Two Assignment

PRG/280 Version 5

3

Copyright © 2017 by University of Phoenix. All rights reserved.

NOTE : PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
I am trying to make a contact form to give input on another browser window. I...
I am trying to make a contact form to give input on another browser window. I am only getting the php code. I am trying to figure out why it won't post. Her is my html and php files: <!DOCTYPE html> <html> <head> <title>Contact</title> <link rel="stylesheet" href="main.css"> </head> <body>    <h1>Contact Form</h1> <nav> <ul> <li><a href="index.html">Home</a></li> <li><a href="page2.html">My PodCast</a></li> <li><a href="page3.html">Contact Me</a></li> <li><a href="page4.html">Resources</a></li> <li><a href="addressbook.html">Address Book</a></li> <li>Contact Form</li> </ul> </nav> <center><h2>Please fill out form</h2> <div id='container'> <div id='header'></div> <center><h3>Contact</h3>...
In the previous assessment, you used a static set of named variables to store the data...
In the previous assessment, you used a static set of named variables to store the data that was entered in a form to be output in a message. For this assessment, you will use the invitation.html file that you modified in the previous assessment to create a more effective process for entering information and creating invitations for volunteers. Rather than having to enter each volunteer and create an invitation one at a time, you will create a script that will...
Hello, I am trying to create a java script code that can arranges the input lowest,...
Hello, I am trying to create a java script code that can arranges the input lowest, highest, finding average, sort them and the clear form functionality. I managed to create the code that sorts the number input from lowest to highest but I am stuck on the rest. See the code below Please help. <!DOCTYPE> <html> <head> <title>EXAM01_01</title> <style type="text/css"> form{color:black;background-color:lightgray;border:6px solid black;border-width:4px;width:450px;margin:1px;padding:1px;} #ans1,#ans2,#ans3,#ans4,#numbers{background-color:white;border:4px solid black;} input[type="button"]{color:black;background-color:red;border:4px solid black;} input[type="text"]{margin:2px;} div.title{color:white;background-color:black;float: left; width: 450px; text-align:center;} </style> <script>    function readNumbers()...
Java Script I need the code to produce these 3 output. I can only get it...
Java Script I need the code to produce these 3 output. I can only get it to produce input #3 I need it to produce the following: // Input #1: // http://www.example.com // Output // http://www.example.com // Input #2: // http://www.example.com?name=r2d2 // Output // http://www.example.com // name: r2d2 // Input #3: // http://www.example.com?name=r2d2&email=r2d2%40me.com&human=no // Output // http://www.example.com // name: r2d2 // email: [email protected] // human: no THIS IS WHAT I HAVE SO FAR: HTML <!DOCTYPE html> <html lang="en"> <head> <meta...
Please linked both files. For this assignment you need to create a ToDo list using Javascript,...
Please linked both files. 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...
<?php    if(isset($_GET['submit'])){ //sanitize the input        /* Check the error from the input: if...
<?php    if(isset($_GET['submit'])){ //sanitize the input        /* Check the error from the input: if input from user is empty -> get an error string variable if input is not empty -> use preg_match() to match the pattern $pattern = "/^[1-9][0-9]{2}(\.|\-)[0-9]{3}(\.|\-)[0-9]{4}$/"; -> if it's a matched, get a success string variable */           } ?> <!doctype html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <!-- Bootstrap CSS --> <link...
<!doctype html> <html lang=”en”>   <head>     <title>Principal Calculation Form</title>     <meta charset="utf-8"/>         
<!doctype html> <html lang=”en”>   <head>     <title>Principal Calculation Form</title>     <meta charset="utf-8"/>                   <script src="code.js"></script>   </head>      <body onload="setFocus();">     <div class="container">                                       <div class="main">                                                                                <form action="#" method="post" name="form_name" id="form_id" class="form_class" >                                                                           <h2>--Principal Loan Form--</h2>                                                                                                                                                      <h5>Disclaimer: This software by no mean will precisely predict your mortgage through your lender company.  This Software will only assume the four items below in order to make an educated guess or prediction to your exact mortgage interests amount and the duration of your loan from your lender. <img...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT