Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Option #1: Square Root Calculation in JavaScript In this week's Critical Thinking Assignment, you'll create an app that calculates the square root of any number
Option #1: Square Root Calculation in JavaScript
In this week's Critical Thinking Assignment, you'll create an app that calculates the square root of any number that a user enters. 1. In your text editor, open the index.htm file from the HandsOnProject7-1 folder in the Chapter07 folder , add your name and today's date where indicated in the comment section, and then save the file. 2. Before the closing /body tag, add a script element containing the following global variable declarations: varvalueElement=document.getElementByID("value")varresultElement=document.getElementByID("sqRoot"); 3. Below the global variable declaration, add the following function to calculate the square root of the number entered and convert it to a string with two decimal places: 4. Below the convert() function, add the following function to create event listeners: 5. Below the createEventListener(), add the following statements: 1 if (window.addEventListener) \{ 2 window.addEventListener("load", createEventisterner, false); 3 \} else if (window.attachEvent) \{ 4 window.attachEvent ("onload", createEventListern); 5 " 6. Save your changes to index.htm, open index.htm in a browser, enter 25 in the Enter a number box, and then click the Calculate square root button. The Square root box should display the value 5.00, as shown in Figure 7-19. Figure 7-19: Square root calculator 7. Debug your code as necessary until it functions correctly. Submission Requirements: Your paper/submission should meet the following requirementsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started