Leser: 23
1
2
3
4
5
6
7
8
<script type="text/javascript">
$(document).ready(function() {
$('body').keyup(function(e) {
var code = e.keyCode || e.which;
// Mache was
});
});
</script>
1
2
3
4
5
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return;
if (keycode == 13) absenden();
1
2
3
4
5
6
7
8
9
10
11
12
13
<script type="text/javascript">
$(document).ready(function() {
$('body').keyup(function(e) {
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return; // nicht auswertbar
if (keycode == 13) {
// Mache was aufgrund Return/Enter
}
});
});
</script>
2010-05-02T09:35:48 moritzIch habe auch schon andere Events als keyup probiert, aber Firefox und Konqueror weigern sich hartnäckig, auf irgend einen dieser Events zu reagieren. Was mache ich falsch?
1
2
3
//-------- initialize handler
document.observe( 'mousemove', this.mousecontrol );
document.observe( 'click', this.mousecontrol );
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html lang="de" xmlns="http://www.w3.org/1999/xhtml" xml:lang="de"> <head> <meta http-equiv="content-type" content="text/html; charset=us-ascii" /> <script src="jquery-1.3.2.min.js" type="text/javascript"> </script> <script type="text/javascript"> //<![CDATA[ $(document).ready(function() { $('html').keyup(function(e) { var code = e.keyCode || e.which; alert(code); }); }); //]]> </script> <title></title> </head> <body> <p>Das ist ein Text.</p> </body> </html>