JavaScript is case-sensitive. So, name
, Name
, and NAME
are considered different identifiers that can be used at the same time for different values.
In this case, it means that each of the references to hangmanform
(lowercase) in the script should be hangmanForm
(camelCase) to match the case used by <form name="hangmanForm">
.
// ...
function formCheck()
{
// Read answer and decide if guess is in the string.
var answer = hangmanForm.answer.value;
var vposition = answer.indexOf(hangmanForm.ltr.value);
// ...
Also, though automatic globals are becoming standard, it's still not necessarily a good practice to depend on them as they can still collide with other uses of global variables.
// ...
function formCheck()
{
// Read answer and decide if guess is in the string.
var form = document.getElementsByName('hangmanForm')[0];
var answer = form.answer.value;
var vposition = answer.indexOf(form.ltr.value);
// ...