CS383: Lab 5 -- Feb 16

In this lab you will write some simple javascript functions in a single web page (written in you class personal web site). The functions will be be each be started by clicking a button. When each function completes, it will put its result into one or more html elements on the page. The goal for this lab is for you to get used to writing Javascript and more comfortable with using Javascript to dynamically update the page in which the Javascript resides. So, feel free to expand or adapt the suggestions here.

The functions

Write the following functions.
  1. Show the count of the number of times that any button on this page has been hit.
  2. Compute the Nth smallest prime number. N should be 3 plus the number of button clicks.
  3. The area of a regular pentagon whose sides have length N+2 (again, N is the number of button clicks).
  4. Start a countdown timer where the timer counts down from N+2 by an interval given by 10000/(N+2). The idea is that the countdown will always take 10 seconds, just the numer shown will change and the interval between number will change. The timer should change the contents of the button that triggers the timer.

Sugestions

What to hand in

Send email to gtowell@brynmawr.edu with a link to the page you created for this lab.