Created
October 2, 2010 14:29
-
-
Save anonymous/607682 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" | |
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"> | |
<head> | |
<title>Titre</title> | |
<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> | |
<script type="text/javascript"> | |
var KEY_ENTER = 13; | |
function fonction_a_lancer() { | |
alert('La touche « Entrer » a été pressée !'); | |
} | |
window.onload = function() { | |
var texte = document.getElementById('texte'); | |
texte.onkeypress = function(event) { | |
if(event.keyCode == KEY_ENTER) { | |
fonction_a_lancer(); | |
return false; | |
} | |
}; | |
}; | |
</script> | |
</head> | |
<body> | |
<div><textarea name="texte" id="texte" cols="40" rows="8"></textarea></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment