[Javascript] Keystroke event
Laurent Muchacho
elmuchacho at gmail.com
Mon Mar 27 04:34:40 CST 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 at denhaag.org> 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 at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20060327/e697e411/attachment.htm>
More information about the Javascript
mailing list