Hola 
chusete 
Un ejemplo: 
 Código PHP:
    <html>
<head>
<script type="text/javascript">
function pulsar(e) {
  tecla=(document.all) ? e.keyCode : e.which;
  if(tecla==13) mifuncion();
}
function mifuncion() {alert('hola')}
</script>
</head>
<body onkeypress="pulsar(event)">
</body>
</html> 
   
  Saludos, 
