1) Awful title description. 2) You didn't even bother testing in other popular browsers. 3) The code is formatted with no spaces.
As the result of the above, I'm not even going to bother running this in any browser. This is a site where all of the above matters!
__________________________________________________________ "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rich Cook
var interval = 5000;
var protected = 1;
window.onload = function () {
timeout = setInterval("createScrn()", interval);
document.onmousemove = function () {
scrnstop();
}
document.onkeydown = function () {
scrnstop();
}
}
function createScrn() {
document.getElementById("black").style.display = "block";
}
function scrnstop() {
clearTimeout(timeout);
timeout = setInterval("createScrn()", interval);
if (protected) {
/* do some security stuff here, you may use ajax for pass check */
/*if(document.getElementById("black").style.display == "block"){
pass = prompt('enter pass');
if(pass == "1992"){
exit();
} else {
return;
}
} else {
return;
}
} else {
exit();
}*/
var key = new Array();
key[65] = "a";
key[66] = "b";
key[67] = "c";
key[68] = "d";
key[69] = "e";
key[70] = "f";
key[71] = "g";
key[72] = "h";
key[73] = "i";
key[74] = "j";
key[75] = "k";
key[76] = "l";
key[77] = "m";
key[78] = "n";
key[79] = "o";
key[80] = "p";
key[81] = "q";
key[82] = "r";
key[83] = "s";
key[84] = "t";
key[85] = "u";
key[86] = "v";
key[87] = "w";
key[88] = "x";
key[89] = "y";
key[90] = "z";
key[13] = "";
keys = new Array();
document.onkeydown = function (event) {
code = event.keyCode.toString();
keys[keys.length] = key[code];
if (event.keyCode == "13") {
if (keys.join("") == "shachi") {
alert('welcome');
exit();
}
else {
alert('stranger');
}
keys = new Array();
}
else if (event.keyCode == "8") {
return false;
}
}
}
else {
exit();
}
}
function exit() {
if (document.getElementById("black").style.display == "block") {
document.getElementById("black").style.display = "none";
}
document.onkeydown = function (event) {
return true;
}
}
<html>
<head>
<script type="text/javascript" src="scrnsaver.js"></script>
<style type="text/css">
#black {
height: 100%;
width: 100%;
background-color: #000;
display: none;
}
</style>
</head>
<body>
<div id="black"></div>
<input type="text">
</body>
</html>
2) You didn't even bother testing in other popular browsers.
3) The code is formatted with no spaces.
As the result of the above, I'm not even going to bother running this in any browser. This is a site where all of the above matters!
__________________________________________________________
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rich Cook
Regards,
Kumar S
GuyFromChennai.com