for(var i=0;i<;i++) { answerLinks[i].onclick = function() { alert(i); answerBoxes[i].value = answers[i]; answerBoxes[i].style.backgroundColor="#ffeeee"; cheated[i]=true; } answerBoxes[i].onkeyup = function() { if (!cheated[i]) { if (answerBoxes[i].value.toUpperCase() == answers[i].toUpperCase()) { if (!answered[i]) { points+=answerPoint[i]; pointsSpan.innerHTML=points; } answerBoxes[i].style.backgroundColor="#eeeeff"; answered[i]=true; return; } answerBoxes[i].style.backgroundColor="transparent"; return; } } hintLinks[i].onclick = function() { var firstLetterA = answerBoxes[i].value.substring(0,1).toUpperCase(); var firstLetter = answers[i].substring(0,1); if (firstLetterA != firstLetter.toUpperCase()) { answerBoxes[i].value = firstLetter; } } } }