Skip to content

Instantly share code, notes, and snippets.

@RobbiNespu
Created January 3, 2016 07:03
Show Gist options
  • Save RobbiNespu/fc74ba25864b5380db98 to your computer and use it in GitHub Desktop.
Save RobbiNespu/fc74ba25864b5380db98 to your computer and use it in GitHub Desktop.
Javascript +html = username and password validation
<SCRIPT Language="JavaScript">
<!--
function Form_Validator(theForm)
{
if (theForm.usernameID.value == "" )
{
alert("Please Key-In Your Username !");
theForm.usernameID.focus();
return (false);
}
if (theForm.passwordID.value == "" )
{
alert("Please Key-In Your Password !");
theForm.passwordID.focus();
return (false);
}
return (true);
}
//-->
</SCRIPT>
<form id="loginForm" name="loginForm" method="post" action="checklogin.php" onSubmit="return Form_Validator(this)">
<input type="text" name="usernameID" size="25">
<input type="password" name="passwordID" size="25">
<input type="submit" name="Submit" value="Login" />
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment