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 2 of 2

Thread: help

  1. #1
    New to the CF scene
    Join Date
    Jul 2002
    Location
    dominican republic
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy help

    i have a problem with this code i dont know whats wrong with it someone help me pls. is a password

    <script language="JavaScript" type="text/javascript">

    function checkpass()
    {

    var 2;

    var 1="pass";

    2=prompt('Your password here',' ');

    if (1==2)
    {

    window.location="pr.php?pass="+1;
    }
    else
    {
    window.location="pr.php?pass=no";
    }
    }

    </script>

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Montreal, Canada
    Posts
    644
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You cannot assign a number a value:

    var 1="pass";

    you can use numbers within the name of variables as long as the first character of the variable name isn't numeric.

    Try something like:

    <script language="JavaScript" type="text/javascript">

    function checkpass()
    {

    var b;

    var a="pass";

    b=prompt('Your password here',' ');

    if (a==b)
    {

    window.location="pr.php?pass="+a;
    }
    else
    {
    window.location="pr.php?pass=no";
    }
    }

    </script>


  •  

    Posting Permissions

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