At school we did the same but then in C#, if I remeber it correctly we did something like this :
//this part creates the number of stripes depending on your word.
//this part also breaks up the complete word into an array.
var word = "programming";
var letters = word.length;
var loose_letters = new Array();
var stripes = new Array();
for(i = 0; i <= letters; i++)
{
stripes[i] = "_";
loose_letters[i] = word.substring(i, i+1);
}
now make something like a textbox where user can fill in the letter with a button
<input type = "text" id = "letter" name = "letter" />
<input type = "button" onClick="checkLetter();" value = "OK" id= "btn_OK" />
the checkLetter function :
function checkLetter()
{
letter = document.getElementById("letter").value;
for(i = 0; i < letters; i++)
{
if(letter == loose_letters[i])
{
stripes[i] = letter;
}
var complete_string += stripes[i]
}
}
I hope this helps, don't forget to add complete_string
to the place where you want your people to see the outcome.