Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] Keystroke event
- From: elmuchacho at gmail.com (Laurent Muchacho)
- Subject: [Javascript] Keystroke event
- Date: Mon Mar 27 04:41:07 2006
Hi
Thanks for the piece of, As you said this does work but it doesn't stop
firefox from opening the "Save Page As" window control.
If you know a way to prevent this from opening it will be great
Many thanks for your help
Laurent
On 3/24/06, J. Lester Novros II <lester@xxxxxxxxxxx> wrote:
>
> 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
> _______________________________________________
> Javascript mailing list
> Javascript@xxxxxxxxxx
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.LaTech.edu/pipermail/javascript/attachments/20060327/e697e411/attachment.html
- Follow-Ups:
- [Javascript] Keystroke event
- From: Flavio Gomes
- [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
- From: J. Lester Novros II
- [Javascript] Keystroke event
- Prev by Date: [Javascript] online tutorials or books
- Next by Date: [Javascript] online tutorials or books
- Previous by thread: [Javascript] Keystroke event
- Next by thread: [Javascript] Keystroke event
- Index(es):