ok third thread today…not doin too good with javascript :-\
So i was just wondering…why do you need to do return true or return false??
And sometimes its just:
return true
and other times its:
return (true)
is there a difference? Not too sure what the return thing is used for :-\ Never used it anything similiar in flash either :-\ Any help would be great thanks!!
you return true or false in order to do something. When you are validating a form you want to return true so the form gets processed or false so that the form doesn’t go thru if there is a problem…
Ah ok…since you’re here i won’t bother making a new thread Do you think you could explain this code from a email validation for me?
function isEmailAddr(email)
{
var result = false
var theStr = new String(email)
var index = theStr.indexOf("@");
if (index > 0)
{
var pindex = theStr.indexOf(".",index);
if ((pindex > index+1) && (theStr.length > pindex+1))
result = true;
}
return result;
}
I just don’t understand:
if (index > 0)
{
var pindex = theStr.indexOf(".",index);
if ((pindex > index+1) && (theStr.length > pindex+1))
result = true;
}
that part (which is basically nearly the whole code :P). It is confusin me:-\ thanks