password validation

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • brijesh

    password validation

    i am relatively new to javascript
    i am trying for a password validation code
    but iam not able to stop the page from loading the page when the
    password is wrong. the code is as below
    ------------------
    <html>
    <head>
    <title>New User</title>
    <script language = "JavaScript ">
    function validatePasswor ds() {
    if (document.passF orm.password1.v alue !=
    document.passFo rm.password2.va lue) {
    alert("Password s don't match, try again");
    document.passFo rm.password1.fo cus();
    document.passFo rm.password1.se lect();
    return false;
    } else
    return true;
    }
    </script>
    </head>

    <body bgcolor="#FFFFF F" text="#000000">
    <form name="passForm" method="post" onsubmit="valid atePasswords()"
    action="http://www.google.com" >
    <h1>New user password form</h1>
    <p> Username: <input type="text" name="username" ><br>
    Password: <input type="password" name="password1 "><br>
    Check password: <input type="password" name="password2 "><br>
    <input type="submit" name="Submit" value="Submit">
    </p>
    </form>

    </body>
    </html>
    -------------------
    can u please tell me where am i going wrong
    thank you
    waiting eagerly for some suggestions
    Brijesh
  • kaeli

    #2
    Re: password validation

    In article <7bccde45.03111 30230.2ecccc21@ posting.google. com>,
    brijesh@divinet access.com enlightened us with...[color=blue]
    > i am relatively new to javascript
    > i am trying for a password validation code
    > but iam not able to stop the page from loading the page when the
    > password is wrong. the code is as below
    >
    > <body bgcolor="#FFFFF F" text="#000000">
    > <form name="passForm" method="post" onsubmit="valid atePasswords()"[/color]

    You forgot the return.
    onsubmit="retur n validatePasswor ds()"



    --
    -------------------------------------------------
    ~kaeli~
    Jesus saves, Allah protects, and Cthulhu
    thinks you'd make a nice sandwich.


    -------------------------------------------------

    Comment

    Working...