Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Aug 2005
    Posts
    257
    Thanks
    8
    Thanked 0 Times in 0 Posts

    validate two password fields

    I want to validate two input text fields.

    If the passwords are equals it show an image called OK.gif (I suppose this is with document.write) but if passwords not are equals it show an image called NOT.gif.


    Regards

  • #2
    Regular Coder
    Join Date
    Jul 2004
    Posts
    201
    Thanks
    8
    Thanked 1 Time in 1 Post
    not tested but should work:
    PHP Code:
    <script type="text/javascript">
    <!--
    /*<![CDATA[*/
    function User() {
    gifyes "yes.gif";        //Gif if yes
    gifno "no.gif";        //Gif if no

    pass1 document.validate.pass1.value;
    pass2 document.validate.pass2.value;

    if (
    pass1 == pass2) {
    handle "<img border=\"0\" src=\""+gifyes+"\">";
    } else {
    handle "<img border=\"0\" src=\""+gifno+"\">";
    }
    document.write(handle);
    }
    /*]]>*/
    // -->
    </script>
    <form method="POST" action="" onsubmit="check();" name="validate">
        <p><input type="password" name="pass1" size="20"></p>
        <p><input type="password" name="pass2" size="20"></p>
        <p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
    </form> 
    Last edited by Anthony2oo4; 08-28-2006 at 11:36 PM.

  • #3
    Regular Coder
    Join Date
    Aug 2005
    Posts
    257
    Thanks
    8
    Thanked 0 Times in 0 Posts
    not work :S

    I put all code into <body></body> tags

  • #4
    Regular Coder
    Join Date
    Aug 2005
    Posts
    257
    Thanks
    8
    Thanked 0 Times in 0 Posts
    PHP Code:
    function verif(){    
    if (
    signupform.reg_pass.value==signupform.reg_retype.value) { 
    document.write("<img src=ok.gif border=0>"); return true 
    } else { 
    document.write("<img src=not.gif border=0>"); return false 
    }

    It works! but it show me the image in other page


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •