Simple box with a button to hold and hide an answer. The button reveals the answer and may be labelled by the author.

Available Functions


startHiddenAnswer(buttonLabel)

Arguments

buttonLabel
a string giving the label for the button.
Return
Nothing is returned
endHiddenAnswer()

Arguments

none

Return
Nothing is returned
Action

A hiddenAnswer container div is created with a button carrying the label. All html within the container is hidden until the button is pressed. The button's a toggle so pressing it a second time hides the answer again.

Comment

Even TM containers may be put in the container. The container is in the flow when hidden so shows at full side. Notes printed using the print button to generate a separate printing window will reflect the state of the hiddenAnswer containers on the original page.


Example

 

Exercises

  1. Write a declaration for each of the following. Make sure you use a mnemonic (self-descriptive) name:
    1. A variable to count the number of students in a class.
    2. A variable to represent the slope of a roof.
    3. A variable to represent the response to a multiple choice exam question, the answer for which is a, b, c, d or e.
    4. A variable to represent the speed of a car.
    5. A constant to represent Avagadro's number (which if you don't know, you can Google).
  2. Rework the ageProblem from the last topic so that it is a separate function and has a constantClient, an anxiousClient, an independentClient and a confusedClient.
int count;

double slope;             or             float slope;

char answer;

float speed;             or             double speed;

const float N = 6.022e23;             or             const double N = 6.022e23;