Hi I am very new to javascript but can't seem to find the anwser on the net, so thought I would post here.
I have an if statement that for some reason runs the first and second if statement but does not process the third if statement or the return statement, can someone point out what I am doing wrong..
thanks
Simon
I have an if statement that for some reason runs the first and second if statement but does not process the third if statement or the return statement, can someone point out what I am doing wrong..
Code:
function registerValidate() {
// does this if statement
if (document.frmRegister.txtFirstname.value == '' || document.frmRegister.txtLastname.value == '')
{
// does this if statement
if (document.frmRegister.txtFirstname.value == '')
{
document.frmRegister.txtErrFirstName.value = 'Required'
}
// does not do this if statement
if (document.frmRegister.txtLastname.value == '')
{
document.frmRegister.txtErrLastName.value = 'Required'
}
// does not do this return statement
return false;
}
else
{
return true;
}
}
thanks
Simon