Sunday, June 29, 2008

TextSearching-Javascript

Simple utilities in javascript for checking user input number in the given numbers.
function ValidTextCheck()
{
var b ="3,5,7,9,10";
var temp = new Array();
temp = b.split(' ');
for(i=0;i < temp.length;i++)
{
var ss=document.getElementById('TextBox1').value;
var sta=temp[i].indexOf(ss);
}
alert(sta);
}

This function will return -1 if the user input doesn't match with pre defined string format variable b.