JavaScript Examples

From Mapping in the Cloud by Michael Peterson


  1. 8_1 - Text: Change the text written by HTML and JavaScript.
  2. 8_2 - Calculation: Change the calculation and add text to the output.
  3. 8_3 - Function: Change the calculation performed in the function and the output text.
  4. 8_4 - External function: Change the external function in the "8-4common.js" file so it performs a different calculation.
  5. 8_6 - Min/Max: Supply a different set of numbers. Change the value of n if needed.
  6. 8_7 - Sort data: Supply a different set of numbers. Change the value of n if needed.
  7. 8_8 - Current time: Add text and spaces to the output line.
  8. 8_9 - Current time AM/PM: Add text to the output line.
  9. 8_10 - Time to event: Change the target date. the output text.
  10. 8_11 - Time to event recursion: Change the target date and output text.
  11. 8_13 - Lat/long distance: Supply different starting/ending values in decimal degrees.
  12. 8_14 - Random numbers: Change the links.
  13. 8_15 - User input text: Change the request.
  14. 8_16 - User input numbers: Change the calculation.
  15. 8_18 - Mouseover as same-sized image: Edit one of the .gif file layers with a graphic editing program like Paint.
  16. 8_19 - Mouseover as layers: Change one of the pop-up text strings.

Extra credit

  1. Write a JavaScript program that converts Fahrenheit to Celsius.
  2. Write a JavaScript program that converts inches to centimenters.

Assignments Page