Actually, I just tried this and it works in Firefox 3 and IE8 beta.
jQuery(function($)
{
var pressed = {};
 $(document).keydown(function(event)
{
// Capture the key being pressed
var keyCode = event.keyCode;
pressed[keyCode] = true;
 // Check if 'S' was pressed
if (83 == keyCode) {
// Check if Ctrl + S (Windows) or Command + S (Mac) was pressed
if (pressed[17] || pressed[224]) {
alert('Custom save dialog!');
event.preventDefault(); // prevent the default save dialog
}
}
});
 $(document).keyup(function(event)
{
delete pressed[event.keyCode];
});
});
-Hector


On Thu, Apr 16, 2009 at 10:54 AM, Hector Virgen <djvir...@gmail.com> wrote:

> You might be able to capture key combos by observing the document for
> keydown and keyup events, and storing the key's down/up state in a variable.
> Then, when the 's' key is pressed, check if 'ctrl' is also pressed.
> But like Ricardo said, CTRL+S may not be capturable since it's a browser
> shortcut.
> -Hector
>
>
>
> On Thu, Apr 16, 2009 at 9:18 AM, Ricardo <ricardob...@gmail.com> wrote:
>
>>
>> As far as I know you can't capture key combinations in Javascript, and
>> even if you could, CTRL+S is a browser shortcut, so it would probably
>> be overriden.
>>
>> On Apr 16, 2:24 am, bharani kumar <bharanikumariyer...@gmail.com>
>> wrote:
>> > Hi All ,
>> > Can u please tell ,
>> >
>> > How to implement  in jquery, php,,
>> >
>> > Insert record after pressed the CTRL+S in keyboard ,
>> >
>> > Thanks
>> >
>> > --
>> > உங்கள் நண்பன்
>> > பரணி  குமார்
>> >
>> > Regards
>> > B.S.Bharanikumar
>> >
>> > POST YOUR OPINIONhttp://bharanikumariyerphp.site88.net/bharanikumar/
>>
>
>

Reply via email to