Change Color of Text Box if Value found in TextBox1

Rajni.Shekhar
Posted by Rajni.Shekhar under JavaScript category on | Points: 40 | Views : 1207
function ChangeColor_FindValue() {
var txtPhrase = document.getElementById("TextBox1").value; //for textbox1
var txtWordToFind = document.getElementById("TextBox2").value; // for textbox2

if (txtPhrase != "") {
var arrWords = txtPhrase.split(" ");
var iIndex = 0;
for (iIndex = 0; iIndex < arrWords.length; iIndex++) {
if (arrWords[iIndex] == txtWordToFind)
{
document.getElementById("TextBox1").style.color = 'gray';
}
}
}
}

Comments or Responses

Login to post response