Results 1 to 4 of 4

Thread: [DHTML] Password script using Hotkey script.

  1. #1
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default [DHTML] Password script using Hotkey script.

    1) CODE TITLE: Password Script

    2) AUTHOR NAME/NOTES: Master_script_maker

    3) DESCRIPTION: A password script that uses the Hotkey script here.

    4) URL TO CODE: Here is the demo.

    or, ATTACHED BELOW (see #3 in guidelines below):

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Doesn't work in FF.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. #3
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default

    I thought it would. Oh well.

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Hmm... nicer to write it like:
    Code:
    (function() {
      var realpass = "password",
        page = "example.html";
    
      var w = "", r = new RegExp("[a-zA-Z0-9" + realpass + "]");
      document.onkeypress = function(e) {
        var v = e || event,
          c = String.fromCharCode(v.charCode || v.which);
        if(r.test(c))
          if(realpass === (w = w + String.fromCharCode(c)))
            location.href = page;
          else if(realpass.substr(0, w.length) !== w)
            w = "";
      };
    })();
    And yes, browsers tend to intercept various keys. It shouldn't be relied on anyway, though, so that's not really a problem; it's just a toy.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •