Please advise How I can get my focus to work. The below checks for blank spaces and does work but cant get the focus to work in this for loop.
function checkData()
{
myFields = new Array(document.myform.fieldOne.value,document.myform.fieldTwo.value);
myValues = new Array("FieldOne", "FieldTwo");
myReg = /^\s*$/;
myInfo = "";
for (i=0; i<myFields.length; i++)
{
if( myReg.test(myFields) )
{
myInfo += "\n" + myValues;
}
}
if (myInfo != '')
{
myInfo += "\n\Enter required values.";
alert(myInfo);
document.myform.focus();
return false;
}
}
function checkData()
{
myFields = new Array(document.myform.fieldOne.value,document.myform.fieldTwo.value);
myValues = new Array("FieldOne", "FieldTwo");
myReg = /^\s*$/;
myInfo = "";
for (i=0; i<myFields.length; i++)
{
if( myReg.test(myFields) )
{
myInfo += "\n" + myValues;
}
}
if (myInfo != '')
{
myInfo += "\n\Enter required values.";
alert(myInfo);
document.myform.focus();
return false;
}
}