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):
Printable View
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):
Doesn't work in FF.
I thought it would. Oh well.
Hmm... nicer to write it like: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.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 = "";
};
})();