Question: In Html/javascript, I need help creating a web page that rolls a pair of dice when a button is clicked. It should prompt the user

In Html/javascript, I need help creating a web page that rolls a pair of dice when a button is clicked.

It should prompt the user for the number of times the dice should be rolled. These rolls will be thrown out (burned) and then use the last roll.

The value the user enters is between 1 and 100.

There should be a line that shows the total of the last roll. On the initial run of the web page roll line should = 0 but after all the rolls it should show the total.

There should be a line that shows the total of the last roll. On the initial run of the web page roll line should = 0 but after all the rolls it should show the total.

They should look like the screen shots below.

In Html/javascript, I need help creating a web page that rolls a

This is the code I have right now, and I'm stuck on how to get it working.

Function dice()

{

diceimg1=one.png;

diceimg2=two.png;

diceimg3=three.png;

diceimg4=four.png;

diceimg5=five.png;

diceimg6=six.png;

//saved images

var dice=math.floor(math.dice()*diceimg1.length);

//calculating

if(dice==1)

{

dice=1;

}

0
0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!