CS 344 - Fall 2018: Assignments

Lab 4
Thursday, October 4, 2018

The assignment is to create an html page with 6 buttons, such that each button triggers a separate javascript function(s) as defined below.

The html page should include some general text, a list of three items, and then the 6 buttons. The js event-handler functions should be set up to respond to the different buttons within the js code. There should be no js code - either inside a <script> tag or associated with an onclick attribute of the buttons - in the html document.

The bottons are as follows:

  1. Alert. This button should generate a sequence of alert messages. The first one should include a prompt, where the user can type in a number. Depending on the number, n, that the user typed in, generate n more alerts, each one displaying a count-down number.
  2. Change style. This button should cause a change in the style of some part of the page. It should also update a message on the page saying which style is currently in effect.
  3. Set Timer. This button should create a timer event, such that when the timer event happens, the innerHTML of some object is changed. The event should be set to go off after a perceivable delay, but not a very long delay.
  4. Stop Timer. This button should cancel the previously set timer event.
  5. Add to List This button should prompt the user for some content, and then add that content as a new item in your list.
  6. Magic. This button should combine the behaviour of some of your other buttons in a fun way! It should also be activated by a different event that is not a click.