solve IT

profilearsasi580
assignment_2_.pdf

Assignment 2 Exercise 1 (2 Marks)

Complete the following code by adding:

(1) A function called AreaBox that takes two arguments, the length and width of the rectangle and returns the Area of a rectangle.

(2) A function called PerimeterBox that takes two arguments, the length and width of the rectangle and returns the perimeter of a rectangle.

(3) A Function called Rectangle that gets the length and the width of the rectangle from the user and displays the area and the perimeter of the corresponding rectangle.

!

<html>

<head>

<title>Rectangles</title>

<script type="text/javascript">

// <!--

// -->

</script>

</head>

<body>

<p> <button onclick="Rectangle()">Rectangle</button></p>

</body>

</html>

Exercise 2 (2 Marks) Create a form jsdom.html with text fields for ID, FirstName, and LastName, and a button called Add. 


When the Add button is clicked, a JavaScript will be called checks if all fields have something and incorrect formatting. Red text will appear above the field(s) that is (are) missing values or incorrect formatting. 
 The following is an example of the red text messages above the three empty fields:

! 
 Note:Make sure to design a proper logic for the warnings, for example, if inputs of ID and FirstName are incorrect and input of LastName is correct, you should only give warnings for the FirstName and ID.

If you enter all the values correctly, use JavaScript to display the results at the bottom of the form. 


The results will look like this.