Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Having problem checking number of attempts to login

  1. #1
    Junior Member
    Join Date
    Mar 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Having problem checking number of attempts to login

    <html>
    <head>
     
    <script Language="JavaScript">
     
    function passCheck();
    {
    	var myPass = document.getElementById("myPass");
    	i=0;
    	while (myPass!=="Ofir")
    	{
    	i=i+1;
    	}
    	if (i>2)
    	{
    		alert("You have reached the attempts limit, Please try again later");
    	}
    	else if (i<2)
    	{
    		alert("We do not recognize you, Please try again.");
    	}
    }
     
    </script>
     
    </head>
     
    <body>
     
    <form method="Post">
    <p>Password: <input type="text" id="myPass"></input></p>
    <input type="submit" onClick="passCheck()"></input>
    </form>
     
    </body>
    </html>

    I've been trying to write a code that recieves a data (password), tho if the person has entered a wrong password
    for over 2 times, he'll get an alert saying he's been banned for a few minutes..

    I dont understand whats wrong with my script, please check this out and help me find a solution?
    Thanks.

    Im a begginer tho, just fyi.


  2. #2
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 139 Times in 134 Posts

    Default Re: Having problem checking number of attempts to login

    You'll want to ask this in a Javascript forum not a Java forum. The languages are pretty far apart you know. Google can help you find the correct spot to post this.

  3. #3
    Junior Member
    Join Date
    Mar 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Having problem checking number of attempts to login

    aight thanks

  4. #4
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: Having problem checking number of attempts to login

    Moved from loops and control statements.

Similar Threads

  1. Problem with LogIn - Multiple users
    By justyStepi in forum AWT / Java Swing
    Replies: 5
    Last Post: April 28th, 2012, 12:18 PM
  2. Checking if number is in between two other numbers?
    By colerelm in forum Algorithms & Recursion
    Replies: 9
    Last Post: November 17th, 2011, 11:34 PM
  3. Buttons and a Login problem
    By raja211991 in forum AWT / Java Swing
    Replies: 1
    Last Post: September 23rd, 2011, 02:41 PM
  4. Java Web Service Client Authentication (limiting the number of failed attempts)
    By pranay_reddy in forum JavaServer Pages: JSP & JSTL
    Replies: 1
    Last Post: September 19th, 2011, 04:30 PM