| 1. |
For this lab you will use if statements to implement a dice-rolling application
- Create an HTML file for this lab assignment called lab6.html
(See the instructions for Lab 2 if you are unsure how to do this.)
- Download the random.js file here
if you don't already have it from last week's lab
- In order to use the functions in the random.js library you will need a script tag with the
src attribute set to random.js
|
| 2. |
Implement the six-sided dice roller.
- Use an image tags to display a pair of dice on your web page
- Add a button that says Click to Roll, and calls the RollTheDice function.
- Write a function called RollTheDice that picks which side of each of the dice to display.
|
| 3. |
Add a counter to the dice roller.
- Add a text box with an initial value of zero to count the number of rolls.
- Modify your function so that each time it is called it adds one to the value in your counter box.
|
| 4. |
Add more counters to the dice roller.
- Add two more text boxes with an initial value of zero.
- The first text box will count the total number of "snake eyes" (double 1's) and "boxcars" (double 6's) that are rolled.
- The second text box will count the total number of "natural sevens" (3,4 or 4,3) that are rolled
- Modify your function so that it adds one to the values in these boxes when appropriate.
- You may find it useful to use the && and || logical operators.
The && operator means AND, and the || operator means OR.
|
| 5. |
When you are done, upload the lab6.html file to the CS server using FileZilla.
(See the instructions for Lab 1 if you are unsure how to do this)
|