Purchase Solution

javascript - random number guessing game

Not what you're looking for?

Ask Custom Question

I want to make a guessing game. Upon clicking the button on the page, the computer will generate a random number between 0-20. I then should guess the number in the first field.(lets say I have 5 attempts).
The number I guess should be compared with the random generated number. If I guess correctly, the second field could display a message like "you win", else it should display "more" or "less" depending on my guess. If I fail to guess those 5 times, I should lose and the answer should appear in the second field.

Attachments
Purchase this Solution

Solution Summary

A random number guessing game is examined for a Javascript.

Solution Preview

This solution focuses on two aspects. There is the HTML that needs to be generated in order to support the required form and there is the javascript needed to implement the required logic.

The HTML is fairly straight forward. There is a button to allow the user to generate the random number, and the input field for entering
guesses, and a button to ask the computer to check the guess. We have also included a text input field for printing messages back to the user.

Each of the HTML input fields has a name associated with this. This allows the field to be easily identified from the javascript code.
Each of the HTML buttons has an "onClick" attribute. This attribute points ...

Purchase this Solution


Free BrainMass Quizzes
Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.