Friday 13 September 2013

Login Check using HTML and JavaScript

<html>
<head>
<title></title>
 <script type="text/javascript">

 function validate()
 {
 var username=document.getElementById('txtname').value;
 var password=document.getElementById('txtpass').value;
 if(username=="abc" && password=="abc")
 {
 window.location="http://www.google.com";
 }
 else
 {
  alert("Login Failed");
  document.getElementById("txtpass").value="";
  document.getElementById("txtpass").focus();
 }
}
 </script> 
   
   
</head>
<body>

    <div>
        <table>
            <tr>
              
                <td>
                UserName
                </td>
                <td>
                <input type="text" name="txtname" size="20" id="txtname"/>
                </td>
            </tr>
            <tr>
                <td>
                    Password
                </td>
                <td>
                    <input type="text" name="txtpass" size="20" id="txtpass" />
                </td>
            </tr>
             <tr>
                <td>
                    &nbsp;
                </td>
                <td>
                <input type="button" value="Submit" onclick="validate()" id="btnsubmit" />
               
                </td>
            </tr>
        </table>
    </div>

</body>
</html>

No comments:

Post a Comment

C# LINQ Joins With SQL

There are  Different Types of SQL Joins  which are used to query data from more than one database tables. In this article, you will learn a...