I can't figure out why I cant get this simple loop to work. I'm using it to validate a form. I thought I could put the required field names in an array, loop through the array and have the it check each field. My Firebug error states that 'document.user_ reg.check' is invalid. I figure it should read as 'document.user. c_fname.value' for example.
[CODE=javascript]
var check=new Array("c_fname" ,"c_lname","c_t itle","c_org"," c_email","c_ema il2","c_phone", "c_password","c _password2");
for(var i=0; i < check.length;i+ +){
if(document.use r_reg.check[i].value==null || document.user_r eg.check[i].value==''){
document.user_r eg.check[i].className='err or';missing++;
}
}
[/CODE]
[CODE=javascript]
var check=new Array("c_fname" ,"c_lname","c_t itle","c_org"," c_email","c_ema il2","c_phone", "c_password","c _password2");
for(var i=0; i < check.length;i+ +){
if(document.use r_reg.check[i].value==null || document.user_r eg.check[i].value==''){
document.user_r eg.check[i].className='err or';missing++;
}
}
[/CODE]
Comment