11548 sujets

JavaScript, DOM et API Web HTML5

Bonjour,

J'ai ici un code qui marche sous Firefox mais pas sous IE :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
	<head>
		<title></title>
	</head>
	<body onkeypress="if (event.keyCode == 40) alert('Fleche du bas');">
		
	</body>
</html>


Page en ligne

Qu'est-ce qu'il faut encore dire à Microsoft pour qu'il comprenne ce petit script ?
Merci d'avance !
Modifié par KelT55 (25 Sep 2011 - 13:23)
Pour ceux qui aurait ce problème onkeypress n'a pas l'air de vouloir fonctionner sous IE 8 donc un onkeydown fait l'affaire.