Ver Mensaje Individual
  #3 (permalink)  
Antiguo 06/05/2012, 14:42
Avatar de IsaBelM
IsaBelM
Colaborador
 
Fecha de Ingreso: junio-2008
Mensajes: 5.032
Antigüedad: 15 años, 10 meses
Puntos: 1012
Respuesta: Controlando el pulsado de enter

ojo, que es importante el evento que se esté usando. con enter no es importante, pero con la mayoría sí
Cita:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<script type="text/javascript">
function compruebaTecla (elm, e) {
var key = (e) ? e.keyCode : e.charCode;
elm.value = key + ' --> ' + String.fromCharCode(key) + ' --> ';
}
</script>
</head>
<body>

<b>onkeydown</b>
<form name="f">
<textarea rows="5" cols="20" wrap="soft" onkeydown="compruebaTecla(this, event)"></textarea>
</form>

<br /><br />
<b>onkeypress</b>
<form name="f">
<textarea rows="5" cols="20" wrap="soft" onkeypress="compruebaTecla(this, event)"></textarea>
</form>

<br /><br />
<b>onkeyup</b>
<form name="f">
<textarea rows="5" cols="20" wrap="soft" onkeyup="compruebaTecla(this, event)"></textarea>
</form>

</body>
</html>
__________________
if(ViolenciaDeGénero) {alert('MUJER ASESINADA');}