Monday, June 4, 2007

Javascript on Dynamic Textboxes

A=0
B=0
if(this.document.f1.h1.value!="")
{

for(var A=1;A<=this.document.f1.h1.value;A++)
{
if(this.document.getElementById("txt"+A).value=="")
{
alert("Please enter no "+A)
document.getElementById("txt"+A).select();
return false
}
for(var B=A+1;B<=this.document.f1.h1.value;B++)
{
if(this.document.getElementById("txt"+A).value==this.document.getElementById("txt"+B).value)
{
alert("Two no's can't b same "+B)
document.getElementById("txt"+B).select();
return false
}
}
}

}

No comments: