Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] Capture Ctrl-keys in Input Text or forms objects.
- From: javascript@xxxxxxxxxx (Jean-Francois Larocque (LMC))
- Subject: [Javascript] Capture Ctrl-keys in Input Text or forms objects.
- Date: Wed, 24 Jul 2002 14:37:18 -0400
Hi, I am developping a Secure web browser for an intranet.
basically we want to control the pages accessed.
I have control on the client side of Netscape 4.75=20
so we launch it in kioskmode (No menu, buttons, status or location bar)
I want to keep my users to use CTRL-O or CTRL-N because when the new =
window
appears,=20
the kioskmode is not preserved.
I wrote the following script to capture events related to rightt click =
and
CTRL-keys functions
but I enconter the following problem:
When the focus is in a form, the onKeyPress does not catch the CTRL key
combinaison attached to Netscape functions.
So a user could manage to open a new windows by pressing CTRL-New when =
the
focus is in a form.
In the form, it seems that the only event captured is onkeyup.
I capture the events at the highest level, ie in the windows object.=20
Should I capture it specifically in the form?
What woulb be the syntax?
<SCRIPT LANGUAGE=3D"JavaScript1.2"><!--
function netscapeKeyPress(e) {
if (e.modifiers )//& Event.CONTROL_MASK )
alert('Ctrl keys is not allowed in this secure browser');
}
function right(e) {
if (navigator.appName =3D=3D 'Netscape' && (e.which =3D=3D 3 )){
alert("Right click is not allowed in this secure browser.");
return false;
}
if (navigator.appName =3D=3D 'Netscape' && (e.which =3D=3D 2)){
alert("Middle click is not allowed in this secure browser.");
return false;
} =20
return true;
}
window.captureEvents(Event.KEYPRESS);
window.captureEvents(Event.MOUSEDOWN);
window.onKeyPress =3D netscapeKeyPress;
window.onmousedown=3Dright;
//--></SCRIPT>
</HEAD>
<BODY>
<BR><BR><BR>
<form NAME=3Doutput>
<p><input type=3D"text" onKeyPress=3D"netscapeKeyPress(event)"
size=3D"20">=20
</form>
</BODY>
I searched the usegroup and it seems that the problem was encontered =
before
but
I could not extract an applicable solution to my problem.
Here are the links to the previous threads related to my problem:
http://groups.google.ca/groups?hl=3Den&lr=3D&ie=3DUTF-8&selm=3D3547027F.=
DEFB15DB%40w
ipsys.soft.net
http://groups.google.ca/groups?hl=3Den&lr=3D&ie=3DUTF-8&threadm=3D361410=
5F.B1856B9D%
40sector27.de&rnum=3D13&prev=3D/groups%3Fq%3Djavascript%2Bctrl%2Bevent%2=
Bcapture
%26start%3D10%26hl%3Den%26lr%3D%26ie%3DUTF-8%26selm%3D3614105F.B1856B9D%=
2540
sector27.de%26rnum%3D13
http://groups.google.ca/groups?q=3Djavascript+ctrl+event+capture+form&hl=
=3Den&lr
=3D&ie=3DUTF-8&scoring=3Dd&selm=3D38E90DCF.4BBC14E5%40knowspam.lucasfilm=
.com&rnum=3D9
Netscape 4.75
Jean-Fran=E7ois Larocque
LMC/XB/A CDMA OSS Integration
Ericsson Research Canada
8300 Boulevard Decarie
Ville Mont-Royal (Quebec)
Canada H4P 2P5
Tel: 514-345-7900 x2208
mailto:lmcjfla@xxxxxxxxxxxxxxx
- Prev by Date: [Javascript] Trapping "File not Found"
- Next by Date: [Javascript] Silent window.close... or a better idea
- Previous by thread: [Javascript] Q on parsing
- Next by thread: [Javascript] Silent window.close... or a better idea
- Index(es):