Ver Mensaje Individual
  #2 (permalink)  
Antiguo 26/04/2012, 18:58
Avatar de emprear
emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 10 meses
Puntos: 1567
Respuesta: Salto de linea en textArea

Quisiera decirte que es tan facil como poner el atributo wrap="hard" al textarea, pero lamentablemenet Firefox no lo reconoce, si estás procesando los datos con php, te queda la alternativa de hacer wordwrap()

Código HTML:
Ver original
  1. <!DOCTYPE html>
  2. <html lang="es-ar">
  3. <meta charset="utf-8" />
  4. <title>Html5</title>
  5. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  6.  
  7. <style type="text/css">
  8. /*<![CDATA[*/
  9.  
  10. textarea {
  11. resize: none;
  12. }
  13.  
  14. /*]]>*/
  15. </head>
  16. <form action="wrap.php" method="post">
  17. <textarea name="contenido" rows="20" cols="50" id="contenido" wrap="hard"></textarea>
  18. <input type="submit" />
  19. </form>
  20. </body>
  21. </html>


Código PHP:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <title>titulo</title>
  6. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  7. </head>
  8. <body>
  9. <?php
  10. $texto = $_POST['contenido'];
  11. $ntexto = wordwrap($texto, 60,"\n",true);
  12. echo "<pre>$ntexto</pre>";
  13. ?>
  14. </body>
  15. </html>

saludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.