Hangman

This script encompasses most of the techniques used in the earlier examples, as well as some new ones. This script fully implements a game of hangman. The computer picks a word from its 'vocabulary' - a list of words supplied in the script - and the user has to guess letters to make up the word. Each incorrect guess causes another piece of the hangman to be drawn onscreen.
Below is the contents of hangman.js:
Here is the code for the form on the page. Some of the buttons have been omitted, but they are all handled the same way.
<form name="hangForm">
<textarea name="drawing" rows="7" cols="15"></textarea><br>
<input type="text" name="word"> Word to guess<br>
<input type="text" name="guessed"> Letters guessed so far<br>
<input type="button" value=" A " onClick="guess('A')">
<input type="button" value=" B " onClick="guess('B')">
     .     .     .     .     .     .     .
<input type="button" value=" Y " onClick="guess('Y')">
<input type="button" value=" Z " onClick="guess('Z')">
<br>
<input type="button" value="Start Over" onClick="restart()">
</form>


Word to guess
Letters guessed so far