Ver Mensaje Individual
  #5 (permalink)  
Antiguo 22/12/2006, 22:34
frijolerou
 
Fecha de Ingreso: diciembre-2003
Mensajes: 1.583
Antigüedad: 20 años, 4 meses
Puntos: 13
Re: Evitar uso tecla ENTER en textarea

Quisiera aportar con lo siguiente. Esta función captura el contenido del textarea, reemplaza los saltos de línea (claro que también incluye SHIFT+ENTER) por otro caracter (en el ejemplo por un espacio en blanco). La función se ejecuta cuando el textarea pierde foco.

Código:
<html>
<head>
<script>
function noEnter(textfield){
	string = textfield.value;
	string = string.replace(/\n/g, " ");
	textfield.value = string;
}
</script>
</head>
<body>
<textarea cols="10" rows="10" onblur="noEnter(this)"></textarea>
</body>
</html>
__________________
El conocimiento es libre: Movimiento por la Devolución