[Javascript] Keystroke event

Flavio Gomes flavio at economisa.com.br
Mon Mar 27 07:28:39 CST 2006


In GMail you can use Ctrl+I, Ctrl+U, Ctrl+B for formatting your rich 
text e-mails

I tried for some time to find the code, but it was pretty complicated. 
If you have the time and skills, check it there and then post it here, ok?

Laurent Muchacho escreveu:

> 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 
> <mailto: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 <mailto:Javascript at LaTech.edu>
>     https://lists.LaTech.edu/mailman/listinfo/javascript
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript
>  
>

-- 
Flavio Gomes
flavio at economisa.com.br




More information about the Javascript mailing list