Design and implement a Web page named dotrace.html that allows the user to simulate a race between

Question:

Design and implement a Web page named dotrace.html that allows the user to simulate a race between two dots. Your page should look something like the one in Figure 11.15. The length of the race (i.e., the goal distance) is entered by the user in a text box, and the positions of the two dots (initially 0) are displayed in text spans. Each time the user clicks the button labeled "Take a Step", each dot should move forward a random amount (either one, two, or three units). When one of the dots crosses the finish line-meaning that its current position is greater than or equal to the goal distance-an alert box should appear to identify the winner. Note that it is possible for the dots to tie if both cross the finish line on the same step. Thus, your code must be able to recognize a tied race and display an appropriate message in the alert box.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: