- Create a lab8 folder both locally and at your web server.
- Type in the following HTML and JavaScript code. Do not cut and paste. Before you type the code in save the file as greet.html.
Greetings
First JavaScript Example
Here you will find all sorts of far out and groovy stuff I am into.
- Modify greet.html so the JavaScript output is broken across two lines. For example if I enter tony into the dialog box the output would be.
Greetings tony,
welcome to my page.
To do this you will insert a
or
tag inside the string before welcome.
- Type in the following HTML and JavaScript code. Do not cut and paste. Before you type the code in save the file as band.html. The purpose of this exercise is to show you a variable can be used and assigned multiple times. However this program has a bug. First type in the program and run it. Then correct the bug.
Band
- Type in the javascript code. Do not cut and paste.
Javascript to convert Fahrenheit to Celsius
Fahrenheit to Celsius Converter
- Study the above code you typed in. Write a complete javascript program to convert a temperature from Celsius to Fahrenheit. Do not modify the one above, start from scratch. The formula is
fahrenheit = (9 * celsius) / 5 + 32
- Write a complete Javascript program to compute the volume and surface area of a sphere using the following formulas.
You have to prompt the user for the radius from the user.
volume = (4.0/3.0) * 3.14 * radius * radius * radius
Where (radius)^3 is radius raised to the 3rd power.
surfaceArea = 4 * 3.14 * radius * radius
- Follow these instructions.