27/06/2016, 13:34
|
| | Fecha de Ingreso: junio-2016
Mensajes: 3
Antigüedad: 8 años, 7 meses Puntos: 0 | |
Respuesta: Duda con manejo de cadenas Hola puede encontrar la forma de solucionar la visualizacion de la informacion gracias a tu respuesta Alexis88 lo que hice fue migrar el funcionamiento de la funcion nl2br de PHP a js y bueno me funciono bien.
<!DOCTYPE html>
<html lang=es>
<head>
<meta charset="utf-8">
<script type="text/javascript">
function Parrafos(){
var texto = document.getElementById("texto").value;
var aux = "";
aux = texto.replace(/\n/g, "<br>");
document.getElementById("textohtml").innerHTML = aux;
}
</script>
<style>
#textohtml{
text-align: justify;
}
</style>
</head>
<body>
<section>
<textarea id="texto"></textarea>
<input type="button" name="mostrar" value="mostrar" onclick="Parrafos()" />
<div id="textohtml">
</div>
</section>
<body>
</html>
doy este tema por solucionado mil gracias por tu ayuda. |