Hi guys i goy a problem with my js. I have got 4 if statements on a page were if the user enters for example 25 the box will turn blue. Now what I want is that after the user inputs 4 things and all boxes are blue I want an image to appear. I will post the code and the codes which I have tried.
Code:function changecolour1(textbox) { //Function name and passing it the priamter textbox var val = textbox.value; //Everthing on the right side gets copyed to the left side if (val == 26) { //checks if val has the value of 26 textbox.style.backgroundColor = 'blue'; //if it dose it will go blue } else { textbox.style.backgroundColor = 'red'; //if it dose not match it will go red } addresult() } function changecolour2(textbox) { var val = textbox.value; if (val == 20) { textbox.style.backgroundColor = '0000FF'; } else { textbox.style.backgroundColor = 'FF0000'; } } function changecolour3(textbox) { var val = textbox.value; if (val == 63) { textbox.style.backgroundColor = 'blue'; } else { textbox.style.backgroundColor = 'red'; } } function changecolour4(textbox) { var val = textbox.value; if (val == 36) { textbox.style.backgroundColor = 'blue'; } else { textbox.style.backgroundColor = 'red'; } }Any help would be great.Code:function addresult() { var val = Inputbox1.value; if ( val == 1) { alert ("Foo") } }


Reply With Quote

Bookmarks