SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast mpcovcd's Avatar
    Join Date
    Oct 2005
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Adding Enter Button to Current Script

    Hello i want to integrate a Enter button with my following script...Rite now the script makes the user type in their password then click out side of the box for it the check the password and let the users in...And if they try to press enter it clears the password. Want it so the users can press enter and it can check the password and so the users can click enter to check the password and let them into the protected page...

    <SCRIPT Language = "JavaScript">

    function passwordOK(anystring) {
    anystring = anystring.toUpperCase()

    if (anystring == "XBOSFUN" || anystring == "XXX" || anystring
    == "XX" || anystring == "X") {
    location="coupons.html"
    }


    else {
    alert ("Invalid Password.")
    location="protected.htm"

    }
    }
    </SCRIPT>



    <FORM>
    <b>Password from NewsJournal AD: </b>
    <INPUT type="password" name='pass' Size = 20 onChange =
    "passwordOK(this.value)">

    </FORM>

    Thanks SP!

  2. #2
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,750
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Never ever ever ever put password authentication in javascript. Anyone can read the source and figure out what password to use! Use a server side language such as PHP or ASP to do this.


Bookmarks

Posting Permissions

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