1. Home
  2. Computing & Technology
  3. JavaScript

Unobtrusive Hangman

Answer generator

Enter the answers you want your hangman script to select from one at a time into the following form. This will "encrypt" your answers to stop people cheating the game by viewing the source.

Create Hangman Answers

Save the above code as hangq.js (or a different name of your choice if you are making multiple games. As you can see the code that represents each of your answers doesn't look anything like the actual word that you selected as the answer so if people view the source they still will not know what your possible answers are. The script will choose one of your answers at random each time the game is played.

Oops, nearly forgot the images. You can either use my images or substitute your own (as long as they are 100 by 100 pixel gif files called hang0.gif through hang10.gif). You just need to save the images to the same folder as holds the other files for the game.

Explore JavaScript
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. JavaScript

©2009 About.com, a part of The New York Times Company.

All rights reserved.