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: Fri Mar 24 05:04:48 2006
Hi
Does anyone know a good reference or have a nice examples to catch the
keystroke ctrl+s in the browser
I wrote this simple function but everytime the browser try to do a save.
This only need to work in firefox.
To explain why I want to do this if anyone is interested, On our cms
everytime you edit a piece of text you have to click the save button and I'm
starting to get tired of this everytime I thought of catching the ctrl+s and
submiting the form automaticly :-)
Many thanks
function keyDown(e) {
var keycode = e.which
if(keycode==17){
document.onkeydown = trigger_ctrlS;
return true
}
}
function trigger_ctrlS(e){
var keycode = e.which
if(keycode==83){
alert("ctrl s: ")
document.onkeydown = keyDown
return true
}
}
document.onkeydown = keyDown
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.LaTech.edu/pipermail/javascript/attachments/20060324/8042b071/attachment.html
- Follow-Ups:
- [Javascript] Keystroke event
- From: Nick Fitzsimons
- [Javascript] Keystroke event
- Prev by Date: [Javascript] enabling print stylesheets on screen
- Next by Date: [Javascript] Keystroke event
- Previous by thread: [Javascript] enabling print stylesheets on screen
- Next by thread: [Javascript] Keystroke event
- Index(es):