Monitor for Password

[Total: 0    Average: 0/5]

Secretly monitor for keys to be entered (password).

Head Code:

var password    = "javascript";
var targetURL   = "/js/";
var charsEntered = 0; /* start with nothing entered */

var isIE5=document.all;
var isNS4=document.layers;
var isIE6=document.getElementById && isIE5;
var isNS6=document.getElementById && ! isIE6;

function getKey(keyStroke) { 
  var eventChooser = (isNS4||isNS6) ? keyStroke.which : event.keyCode; 
  var which = String.fromCharCode(eventChooser).toLowerCase(); 
  if (which == password.charAt(charsEntered))
    if (charsEntered == password.length)
      window.location = targetURL; 
    charsEntered = 0;
document.onkeypress = getKey; 

Body Code:

type the word "<b>javascript</b>"
<BR>Note: Focus must be on the window for it to know keys have been typed.
  -- This following form is here only to show you when it determines correct letters have been entered.
  -- Change the type=text to type=hidden to not have this displayed.
<form name=f1>
<input type=text name=t1 value='-1'>

Times Viewed: 7

Leave a Reply

Your email address will not be published. Required fields are marked *