How to Validate username and password using javascript

Manideepgoud
Posted by Manideepgoud under JavaScript category on | Points: 40 | Views : 9801
    <!DOCTYPE html>
<html>
<head>
<title> </title>
</head>
<body>
<form>
UserName: <input type="text" id="txt1" /><br />
Password:<input type="password" id="txt2" /><br />
<button onclick="myfunction()">Click</button>
</form>
<script type="text/javascript">
function myfunction() {
if (document.getElementById("txt1").value == "Child" && document.getElementById("txt2").value == "father") {
alert("Login SuccessFull");
}
else {
alert("Invalid");
}
}
</script>
</body>
</html>

Comments or Responses

Login to post response