Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] Keystroke event
- From: lester at denhaag.org (J. Lester Novros II)
- Subject: [Javascript] Keystroke event
- Date: Fri Mar 24 09:13:03 2006
Dear Laurent,
Laurent Muchacho wrote:
> If anyone got an idea let it come :-)
This should do it on both Apple and Intel platforms [tested in
Firefox/Safari/xPloder - Linux/Mac OS X/windoze]:
window.onkeydown =
function(event)
{
// normalize event
event = event || window.event;
// check for the 's'- and command-|control-keys
if (event.keyCode == 83 && (navigator.platform == 'MacPPC' ? event.metaKey :
event.ctrlKey))
{
alert('saving...');
// insert your saving routine here
return false;
}
// pass thru original keypress
return true;
}
Would you want it to work in xPloder as well, be aware that it needs
'document.onkeydown' rather than the standard 'window.onkeydown'; specifying
both results in Firefox calling the function twice.
I'll leave Opera as an exercise to the reader since it wouldn't co-operate with
the above code [it still passes the event] in the limited amount of time I had
available.
l8R lES
--
m$ has a note for this xPloder bug on its website with a description and offers
a workaround. It states: "This behavior is by design." The offered workaround
does not help at all.
http://www.denhaag.org
- Follow-Ups:
- [Javascript] Keystroke event
- From: Laurent Muchacho
- [Javascript] Keystroke event
- References:
- [Javascript] Keystroke event
- From: Laurent Muchacho
- [Javascript] Keystroke event
- From: Nick Fitzsimons
- [Javascript] Keystroke event
- From: Laurent Muchacho
- [Javascript] Keystroke event
- Prev by Date: [Javascript] Keystroke event
- Next by Date: [Javascript] Two Actions with one form
- Previous by thread: [Javascript] Keystroke event
- Next by thread: [Javascript] Keystroke event
- Index(es):