mercredi 22 juin 2016

create a login page with email and password in javascript

i want to create a login page.in that i want few things that if i enter wrong email address than it will give alert and if left blank then it will give alert and also for inappropriate email address and in the case of password it will show the same`. here i used userid so please change that to email address

<html>
<head>
    <script language="javascript">
        function check(form) {
            if(form.userid.value == "id@gmail.com") {
                alert("correct username")
            } else if (form.userid.value == "") {
                alert ("blank username")
                                
            } else if(form.pswrd.value == "123") {
                alert("correct details")
            } else if(form.pswrd.value == "") {
                alert ("blank password")
            }
        }
    </script>

</head>
<body>
<h1>Login </h1>
<form name="login">
    Username<input type="text" name="userid"/>
    Password<input type="password" name="pswrd"/>
    <input type="button" onclick="check(this.form)" value="Login"/>
    <input type="reset" value="reset"/>
</form>

</body>
</html>

Aucun commentaire:

Enregistrer un commentaire