View Full Version : Keys
Simply is there any way to disable certain keys on the keyboard while the user is on your web site.
i.e. Alt-F4 Or CTRL-ALT-DEL Or Pause/Break
Or just swap the keys around so they do different functions.
If so could you please tell me how
Thanx
beetle
10-20-2002, 09:55 AM
Sure can. Here's an example....<html>
<head>
<title>key translator</title>
<script>
function translateKey(e) {
if (!isLetter(e.keyCode)) return;
e.keyCode = parseInt(trans[e.keyCode],10);
}
function isLetter(kc) {
for (var i in trans)
if (trans[i]==kc) return true;
return false;
}
var trans = {
81:'65',
87:'66',
69:'67',
82:'68',
84:'69',
89:'70',
85:'71',
73:'72',
79:'73',
80:'74',
65:'75',
83:'76',
68:'77',
70:'78',
71:'79',
72:'80',
74:'81',
75:'82',
76:'83',
90:'84',
88:'85',
67:'86',
86:'87',
66:'88',
78:'89',
77:'90',
113:'97',
119:'98',
101:'99',
114:'100',
116:'101',
121:'102',
117:'103',
105:'104',
111:'105',
112:'106',
97:'107 ',
115:'108',
100:'109',
102:'110',
103:'111',
104:'112',
106:'113',
107:'114',
108:'115',
122:'116',
120:'117',
99:'118',
118:'119',
98:'120',
110:'121',
109:'122'
};
</script>
</head>
<body>
Your'e Keyboard has been remapped! Try it below!<br>
<textarea rows="15" cols="60" onKeyPress="translateKey(event)"></textarea>
<div id="output"></div>
</body>
</html>
Thanks!
But....
All these numbers...are they the ASCII Code?
If so is there any where i can find a list of the ASCII?
And so if I put all that in a script and put it in the onload tag and i found the ASCII code for Alt and F4 then no one could leave by that method?
beetle
10-20-2002, 10:20 AM
I think I've seen people mess with this before, but I don't exactly remember how it goes. You see, both S and F4 return a keyCode of 115, and I don't remember how to differentiate between the two...
Because 'alt' controls system functions, you may not be able to do this....
Philip M
10-20-2002, 11:15 AM
There is no better way to guarantee that people never visit your site again than to mess with the keyboard, prevent them from leaving the page or otherwise annoying them.
May your doctor always be frank with you.
beetle
10-20-2002, 11:20 AM
Originally posted by Philip M
There is no better way to guarantee that people never visit your site again than to mess with the keyboard, prevent them from leaving the page or otherwise annoying them.
May your doctor always be frank with you. I'll 2nd that.
Yea i know but i want them not to come back...lol
Humm so it is the ASCII....
I will get back to ya
Philip M
10-20-2002, 12:07 PM
Originally posted by 101
Yea i know but i want them not to come back...lol
Hum, I suspect that 101 is a very junior (and dare I say possibly immature) member.
So could you put that in a fucntion. (Which loads on the onload)
And so that
0:'66',
0:'67',
0:'68',
0:'69',
0:'70',
Or another number instead of 0 and so all the keys change to 0?
Philip M
10-21-2002, 06:47 PM
As I see it 101 is deliberately attempting to create malware which aims to inflict malicious damage on computers which visit his site. This is against the Terms of Service of his ISP and against the acceptable behaviour rules of this forum.
Many people would consider such a person to be disturbed.
I don't think you quite get me.....
All i wanted was help for the code.
What it's for is for me to decide and is not any of your buissness.
And for you information it is for a laught which people can play at work and at school etc.
Funny.
And I find it very annoying!
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.