Monday, 16 September 2024

WRITE A JAVASCRIPT TO CHECK USERID AND PASSWORD IS SAME OR NOT

 <!DOCTYPE html>

<html>

<body>

<h2> Write a program to check Uid and Password 

are X and Y (X and Y will be fixed strings of your choice). </h2>


<table border="2px">

<tr>

<th>Enter UserName: </th>

<td><input type="text" name="txt_username" 

id="username"/></td>

</tr>

<tr>

<th>Enter Password: </th>

<td><input type="password" name="txt_password" 

id="password"/></td>

</tr>

<tr>

<td colspan="2" align="center"><input type="submit" 

value="Login" onclick="findLogin()"/></td>

</tr>

</table>

<script language="JavaScript">

function findLogin() {

var unm=document.getElementById("username").value;

var pwd=document.getElementById("password").value;

if(unm == "ANAND" && pwd == "ANAND") {

alert("Login Successfull");

}

else {

document.write("UserName or Password do not match");

}

}

</script>


</body>

</html>


No comments:

Post a Comment