previous

page 16

next
Words Check

We now create a words_check function that will use the globals g_word_ids and g_set to check each of the 4 word positions.

Each correct word will have its border changed to green and the text colour changed to brown.

function words_check() {
for (var i=0;i<4;i++) {
var word='';
var arr=g_word_ids[i];
for (var j=0;j<4;j++) {
var id=arr[j];
var element=document.getElementById(id);
word=word+element.textContent;
}
if (word==g_set[i]) {
for (var j=0;j<4;j++) {
var id=arr[j];
var element=document.getElementById(id);
element.style.borderColor='green';
element.style.color='brown';
}
}
}
}
previous
next