The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Please see attached txt file (javascript.txt) In Notepad, make changes to the JavaScript code so that it will do this instead:
allow you to enter the radius of a circle (you can remove the 2nd input box)
allow you to click the Calculate button
when you click the Calculate button, it will pop up an alert box that displays a message with the
area of the circle
The mathematical formula for area of a circle is A = π r2. JavaScript doesn't have an exponent operator, though, so to get r-squared you just multiply r by r. You can use 3.14159 for the value of pi.
Change the description to “This program will find the area of a circle” and be sure to change the other text
items on the web page and in the alert box so that they make sense.
Save as an html file label it Lab.html
<!DOCTYPE HTML PUBLIC ~//W3C//DTD HTML 4.01 Transitional//EN> <html> <head> <title>Working with Form Data</title> <script type="text/javascript"> function calculate_onclick(){ a = formOne.Side1.value; b = formOne.Side2.value; c = Math.sqrt(a*a + b*b); window.alert("The hypotenuse is " + c); } </script> </head> <body> <font size="5" color="blue"> This program will calculate the length of the hypotenuse of a right triangle. </font><br/><br/> <form name="formOne"> Input Length of 1st Side: <input type="text" name="Side1"/><br /> Input Length of 2nd Side: <input type="text" name="Side2"/><br /> <input type="button" name="calculate" value="Calculate" onclick="calculate_onclick()"/> </form> </body> </html>
Attachments: