JavaScript is not working:
// HTML
<form id="formLogin" name="formLogin" method="post" action="" onsubmit="validateForm(this) /">
<div class="divLogin">
<table>
<tr>
<td> Enter your Email: </td>
<td> <input type="text" id="checkemail" name="txtEmail" required="required" autocomplete="off" /> </td>
</tr>
<tr>
<td> Enter your Password: </td>
<td> <input type="password" id="checkpwd" name="pwd" minlength="6" required="required" autocomplete="off" /> </td>
</tr>
</table>
</div>
<div>
<input type="submit" class="btnLogin" value="Go" style="display:inline-block; margin-left:350px; font-weight:bold; font-size:12px;" />
</div>
</form>
// JS
function validateForm()
{
var checkemail=document.["formLogin"]["txtEmail"].value;
var atpos=checkemail.indexOf("@");
var dotpos=checkemail.lastIndexOf(".");
var checkpwd=document.forms["formLogin"]["pwd"].value;
if (checkemail==null)
{
document.getElementById("checkemail").innerHTML = "Please Enter Email Address";
return false;
}
if (checkpwd==null)
{
document.getElementById("checkpwd").innerHTML = "Please Enter Password";
return false;
}
if (atpos<1 || dotpos<atpos+2 || dotpos+2>=checkemail.length)
{
alert("Not a valid e-mail address");
return false;
}
if (checkpwd==null || checkpwd=="")
{
alert("Password must be filled out");
return false;
}
}