Just made a simple text game using JavaScript. Were I ask a math question and the user has to enter a value. There are 4 boxes on the page and what I am trying to figure out is how do I get it so when the user enters all the right answers for something like text to pop up on the page.
Below. the code has been repeated 4 times.
function changecolour1(textbox) {
var val = textbox.value;
if (val == 26) {
textbox.style.backgroundColor = 'green';
} else {
textbox.style.backgroundColor = 'red';
}
}
So again just trying 2 figure out when the user enters the right number in the 4 boxes how do I get it so it pops up saying well done.
1 Answer