Using hangman on your page

To have the page use a random word, the following HTML should work. This chooses a random word from hangman, guillotine, and executioner. You can place any number of words in place of these three, with quotes around each word and a comma separating each of them.

<center>

<script src="http://www.cs.cmu.edu/~cburch/hang/hang0.js">
</script>

<script>
<!--
var hangDictionary = new Array(
	"hangman", "guillotine", "executioner"
);

function hangNew() {
	var word = hangDictionary[Math.floor(hangDictionary.length * Math.random())];
	document.output.word.value = word;
	hangRestart();
}
// -->
</script>

<img name=status src=http://www.cs.cmu.edu/~cburch/hang/hang00.gif>

<form name=output>
<input type=hidden name=word>
<table>
<tr><th>Word:</th><td><input name=blanks onFocus="document.input.guess.focus()"></td></tr>
<tr><th>Guessed:</th><td><input name=guesses onFocus="document.input.guess.focus()"></td></tr>
</table>
</form>

<form name=input onSubmit="return hangGuess()">
<table>
<tr><th>Guess:</th><td><input size=1 name=guess></td></tr>
<tr><td colspan=2 align=center><input type=submit value="Guess">
  <input type=button value="New problem" onClick="hangNew()"></td></tr>
</table>
</form>

<script>
<!--
hangNew();
// -->
<script>
<center>

This script puts the following onto the page.


Word:
Guessed:
Guess: