1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
   |  
<!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" lang="fr">
<head>
        <title>Expérience</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<form method="post" action="test.php" >
	<input id="case1" type="text" name="ind_nom" />
	<input  class="submit" id="submit" type="submit" value="Valider"/>
</form>
 
<script language="Javascript" type="text/javascript">
 
var e1 = document.getElementById('case1');	
 
if (e1.addEventListener){e1.addEventListener('click',function(e){alert('test1')},false);}
else if (e1.attachEvent){e1.attachEvent('onclick',function(e){alert('test1 IE')},false);}
 
if (e1.addEventListener){e1.addEventListener('keypress',function(e){alert('test2')},false);} 
else if (e1.attachEvent){e1.attachEvent('onkeypress',function(e){alert('test2IE')},false);}
 
if (e1.addEventListener){e1.addEventListener('keydown',function(e){alert('test3')},false);}
else if (e1.attachEvent){e1.attachEvent('onkeydown',function(e){alert('test3IE')},false);}
 
if (e1.addEventListener){e1.addEventListener('blur',function(e){alert('test4')},false);}
else if (e1.attachEvent){e1.attachEvent('onblur',function(e){alert('test4IE')},false);}
</script>
 
</body>
</html> | 
Partager