+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: basic password check - quick help!! - javascript

  1. #1
    goldy300's Avatar
    goldy300 is offline x10Hosting Member goldy300 is an unknown quantity at this point
    Join Date
    Jul 2008
    Location
    Australia
    Posts
    33

    Question basic password check - quick help!! - javascript

    Can someone help me with this... I don't know it yet but need to know it quick as I have a test on it tomorrow. Could you please make sure it's as basic as the instructions require.

    Here's the question

    Create a web application that will check your password. You are allowed three attempts. Use the body load event (<body onload = “functionName()”) to activate the function, and the prompt dialog box to obtain the password. If the password is successful, direct the User to a “good” page, otherwise direct the User to a “bad” page.

  2. #2
    Scoochi2's Avatar
    Scoochi2 is offline x10 Sophmore Scoochi2 is an unknown quantity at this point
    Join Date
    Aug 2008
    Location
    Southport!
    Posts
    185

    Re: basic password check - quick help!! - javascript

    Without actually knowing what your test is on and what you've already learned/supposed to have learned, I don't know exactly how to do that.
    Where is the password coming from? I'll assume a basic level of JS tutoring, and the following is a function that may work (although the password could be revealed by viewing the source).
    And I'm not sure how you would've been told how to 'direct to a page', so I've put a little comment where you need to add that bit.
    Code:
    <script type='text/javascript'>
    function get_password() {
    var count = 0;
    var pass = 'Teh Paszw0rd!';
    var guessed = 0;
    
    while ((count < 3) && (guessed == 0)) {
      var input = window.prompt('What is the password?','');
      if (input == pass)
        guessed = 1;
      count++;
      }
    if (guessed == 1) {
      // direct to 'good' page
      }
     else {
      // direct to 'bad' page
      }
    }
    </script>
    Last edited by Scoochi2; 11-19-2008 at 09:48 AM.
    If anyone can see it, my post was meant for anyone who reads it. Don't take it personally or think I'm being condescending... :nuts:

  3. #3
    goldy30's Avatar
    goldy30 is offline x10Hosting Member goldy30 is an unknown quantity at this point
    Join Date
    Jul 2008
    Posts
    60

    Re: basic password check - quick help!! - javascript

    Much appreciated, thanks heaps!!

  4. #4
    Twinkie is offline Banned Twinkie is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Ft. Lauderdale, Florida
    Posts
    1,389

    Re: basic password check - quick help!! - javascript

    Cheating ;)

  5. #5
    Scoochi2's Avatar
    Scoochi2 is offline x10 Sophmore Scoochi2 is an unknown quantity at this point
    Join Date
    Aug 2008
    Location
    Southport!
    Posts
    185

    Re: basic password check - quick help!! - javascript

    Quote Originally Posted by Twinkie View Post
    Cheating ;)
    Um... 'directed revision' ;)

    It's simple enough not to hinder someone's learning of the language (presuming they at least try), whilst also helping them to understand the basics.
    If anyone can see it, my post was meant for anyone who reads it. Don't take it personally or think I'm being condescending... :nuts:

  6. #6
    mattura's Avatar
    mattura is offline x10 Elder mattura is an unknown quantity at this point
    Join Date
    Oct 2007
    Posts
    563

    Re: basic password check - quick help!! - javascript

    I'd always feel happier helping those who say "I tried this and can't get it to work [posts code]" rather than those who say "This is my homework question - I don't know how to do it - can someone do it for me?"
    ----
    Life is a game. The conception is terrible but the graphics are amazing!
    matt.elementfx.com

  7. #7
    compwhizii is offline Banned compwhizii is an unknown quantity at this point
    Join Date
    May 2008
    Location
    The Moon
    Posts
    779

    Re: basic password check - quick help!! - javascript

    Quote Originally Posted by mattura View Post
    I'd always feel happier helping those who say "I tried this and can't get it to work [posts code]" rather than those who say "This is my homework question - I don't know how to do it - can someone do it for me?"
    Thank you for sharing. I've saved it in /dev/null

  8. #8
    goldy30's Avatar
    goldy30 is offline x10Hosting Member goldy30 is an unknown quantity at this point
    Join Date
    Jul 2008
    Posts
    60

    Post Re: basic password check - quick help!! - javascript

    I'd done approx 25 exercises in javascript to do with calculations and selections and I'd searched for similar things to do with iteration similar to the way the questions were put but I couldn't find any. Most of which were getting too complicated for me strait away. I just needed someone to show me how. Besides that, over the past two weeks, we've been swamped with tests on privacy, accessibility, php, databases, SQL and javascript. On top of that we've been trying to code our dynamic websites, prepare for the presentation next week and document status reports, meeting agenda's and attend weekly meetings.

    It wasn't cheating, they weren't even the questions we were given on the test. But the questions to do with loops I had, I understood because of the guys who helped me here.

    So a big fat thankyou to the guys who actually helped!!

  9. #9
    ffashion is offline x10Hosting Member ffashion is an unknown quantity at this point
    Join Date
    Aug 2008
    Posts
    18

    Re: basic password check - quick help!! - javascript

    nice but don,t cheat
    na na na na naaa

  10. #10
    mattura's Avatar
    mattura is offline x10 Elder mattura is an unknown quantity at this point
    Join Date
    Oct 2007
    Posts
    563

    Re: basic password check - quick help!! - javascript

    lol

    nah you just need to prioritise and manage your time better :P

    then you can find many very helpful javascript tutorials which tell you all you need to know. There's nothing complicated in your task, even for those completely new to javascript.

    Well you have your answer, so be happy! No need to justify yourself here, go learn javascript instead. It'll be a better way to spend your time...;)
    ----
    Life is a game. The conception is terrible but the graphics are amazing!
    matt.elementfx.com

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Email Check JavaScript
    By willemvo in forum Programming Help
    Replies: 2
    Last Post: 09-05-2008, 07:48 AM
  2. Replies: 0
    Last Post: 08-17-2008, 01:46 AM
  3. How to check mysql username and password
    By Tideas in forum Free Hosting
    Replies: 5
    Last Post: 08-30-2007, 09:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers