Answered Essay: Can someone help write a JavaScript file for the attachement below.


Can someone help write a JavaScript file for the attachement below.

1.The JavaScript file should contain at least three variables length1, length2 and length3 and assign values to them.

2. The html file has spaces for you to enter areas of specific shapes (via your JavaScript). All these areas need to be calculated from the three variables defined in item 1 above. Make sure your math is correct in calculating areas.Values need to be filled for ids: classname, triangle, circle, rectangle, and totalarea which display the total area of the three shapes.

Shapes Hi! Class name Area of the Triangle: Area of the Circle: Area of the rectangle: Grand total area of all the shapes: 0 Submit Now

Coding of the html file. You cannot change anything to the supplied html that I given below.

  <title>JavaScript &amp; jQuery - Chapter 2: Homework Assignment</title>
  <link rel="stylesheet" href="css/c02.css" />
  <div id="content">
    <div id="message" class="message">Hi!</div>
        <td>Class name: </td>
        <td id="classname"></td>
        <td>Area of the Triangle: </td>
        <td id="triangle"></td>
        <td>Area of the Circle: </td>
        <td id="circle">0</td>
        <td>Area of the rectangle: </td>
        <td id="rectangle">0</td>
        <td>Grand total area of all the shapes: </td>
        <td id="totalArea">0</td></tr>
    <a href="#" class="action">Submit Now</a>
  <script src="js/ch2.js"></script>

Shapes Hi! Class name Area of the Triangle: Area of the Circle: Area of the rectangle: Grand total area of all the shapes: 0 Submit Now

Expert Answer


//declare variables
var length = 3;
var breadth = 4;
var height = 5;
var radius = 6;

// calculate areas
var ra = length*breadth;
var ta = breadth*height/2;
var ca = Math.PI*radius*radius;

function updateValues(){

// assign values to id’s
document.getElementById(‘classname’).innerHTML = ‘Chegg’;
document.getElementById(‘triangle’).innerHTML = ta;
document.getElementById(‘circle’).innerHTML = ca;
document.getElementById(‘rectangle’).innerHTML = ra;
document.getElementById(‘totalArea’).innerHTML = ta+ca+ra;

//update values into html
document.getElementsByClassName(‘action’).onclick = updateValues();

Buy Essay
Calculate your paper price
Pages (550 words)
Approximate price: -

Help Me Write My Essay - Reasons:

Best Online Essay Writing Service

We strive to give our customers the best online essay writing experience. We Make sure essays are submitted on time and all the instructions are followed.

Our Writers are Experienced and Professional

Our essay writing service is founded on professional writers who are on stand by to help you any time.

Free Revision Fo all Essays

Sometimes you may require our writers to add on a point to make your essay as customised as possible, we will give you unlimited times to do this. And we will do it for free.

Timely Essay(s)

We understand the frustrations that comes with late essays and our writers are extra careful to not violate this term. Our support team is always engauging our writers to help you have your essay ahead of time.

Customised Essays &100% Confidential

Our Online writing Service has zero torelance for plagiarised papers. We have plagiarism checking tool that generate plagiarism reports just to make sure you are satisfied.

24/7 Customer Support

Our agents are ready to help you around the clock. Please feel free to reach out and enquire about anything.

Try it now!

Calculate the price of your order

Total price:

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.


Let us write that nagging essay.


Submit Your Essay/Homework Instructions

By clicking on the "PLACE ORDER" button, tell us your requires. Be precise for an accurate customised essay. You may also upload any reading materials where applicable.


Pick A & Writer

Our ordering form will provide you with a list of writers and their feedbacks. At step 2, its time select a writer. Our online agents are on stand by to help you just in case.


Editing (OUR PART)

At this stage, our editor will go through your essay and make sure your writer did meet all the instructions.


Receive your Paper

After Editing, your paper will be sent to you via email.