Jump to content

Can someone tell me what does this part of code do? i have look through w3cschool and i dont understand.


Leon

Recommended Posts

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<meta content="en-us" http-equiv="Content-Language" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 1</title>
</head>
<body>
<form name="checkmail" onSubmit="return checkemail()" method="post"
action="javascript:alert('The form is submitted!!!')">
Please enter your email<br />
<input name="Text1" type="text" />
<input name="Button1" type="submit" value="submit" />
</form>
<script language="javascript" >
function checkemail(){
var email=document.checkmail.Text1.value;
if (email.indexOf(' ')==-1
&& 0 < email.indexOf('@')
&& email.indexOf('@')+5< email.length
)return true;
else alert('Invalid Email address')
return false;
}
</script>
</body>
</html>
if (email.indexOf(' ')==-1
&& 0 < email.indexOf('@')
&& email.indexOf('@')+5< email.length
)return true;
else alert('Invalid Email address')
return false;
}
Can someone tell me what does this part of code do? i have look through w3cschool and i dont understand.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...