[Javascript] Keystroke event
Laurent Muchacho
elmuchacho at gmail.com
Fri Mar 24 05:04:40 CST 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.evolt.org/pipermail/javascript/attachments/20060324/8042b071/attachment.htm>
More information about the Javascript
mailing list