phani
11-29-2002, 10:38 AM
can any one tell what's wrong in the code:
function check()
{
objList=new Array(0);
for(var i=0;i<document.forms[0].elements.length;i++)
{
if(document.forms[0].elements[i].style.display!="none")
objList.push(document.forms[0].elements[i].name);
}
for (i=0;i<objList.length;i++)
{
if (isEmpty(document.forms[0][objList[i][0]].value))
{
alert("Please dont leave this field empty, enter some value");
document.forms[0][objList[i][0]].focus();
return false;
}
}
return true;
}
i have stored the elements which r visible into an array and i need to access the elements(form elements) of the array and their values.
function check()
{
objList=new Array(0);
for(var i=0;i<document.forms[0].elements.length;i++)
{
if(document.forms[0].elements[i].style.display!="none")
objList.push(document.forms[0].elements[i].name);
}
for (i=0;i<objList.length;i++)
{
if (isEmpty(document.forms[0][objList[i][0]].value))
{
alert("Please dont leave this field empty, enter some value");
document.forms[0][objList[i][0]].focus();
return false;
}
}
return true;
}
i have stored the elements which r visible into an array and i need to access the elements(form elements) of the array and their values.