In a form I've many controls and some text boxes which I've created on the fly.I have to do a javascript validation so that i dont put duplicate entry in the text boxes which were created on fly. I'm having problem with the syntaxes.


The code i'm writing is something like this..pls help me on this.var index = 1;

obj = document.frmStocks.elements;
icount = obj.length;
for (i = 0; i < icount; i++)
{
if (obj(i).name == 'txtDrum' + index)
{
for (j= 1;j< icount; j++)
{
alert(index);
alert(j);
if (index!=j)
{
/if (obj(index).value == obj(j).value)
//alert("sid" + i);
//alert("sin" + j);
/alert(('txtDrum' + index).value);...this gives //undefined
if ('txtDrum' + index.value == 'txtDrum' + j.value)
{
alert("duplicate");
return false;
}
}
}
index++;
}
}