Javascript Problem Hey guys,
A friend of mine is working on a form in javascript for a uni project and is having a bit of bother. She asked me to have a look and I couldnt see anything (not that great at it myself). Any suggestions why its not working would be appreciated.
Thanks [B]else if (document.newmem.Email.value ! = “”)
{
isAtSign=False;
for(var i=0;i< (document.newmem.Email.length);i++)
{
if(document.newmem.Email.CharAt(i) = = “@”)
{
isAtSign = True;
}
}
if(isAtSign != True)
{
alert(“The Email Address you have entered is not valid- please try again”);
document.newmem.Email.focus();
valid=False;
}
} [/b]
newmem is the form name
Email is the text field name for the email to be inputed
The check is that somewhere in the email address there should be a "@" sign.
So it goes in if the email field is not empty, and isAtSign is a variable that is set to false to begin with
It goes in a loop, through all the chars in the email address and sees if it =@
And if it does it puts isAtSign =true
Then theres a check to see if IsAtSign is not true
And if its not then an alert message is thrown up
Valid =false is the thing that is returned later in the page so that the form is not submited |