Ver Mensaje Individual
  #16 (permalink)  
Antiguo 01/02/2006, 17:58
Avatar de Cap.Buscapina
Cap.Buscapina
 
Fecha de Ingreso: octubre-2004
Ubicación: Argentina
Mensajes: 836
Antigüedad: 19 años, 7 meses
Puntos: 4
creo que te puede servir.

Es solo como ejemplo, y basicamente lo que hace es almacenar en un array el texto introducido (en tu caso lo traerías de una BD) reemplazando el salto de linea por otro caracter, y luego al momento de mostrarlo, lo reemplaza nuevamente por el salto de linea en cuestion.

Cita:
<html>
<head>
<script>
var noticias = new Array();
function almacenar(f){
noticias[noticias.length]=f.noticia.value.replace(/\r\n/,"[br]");
f.noticia.value=""
f.Almacenar.value="Almacenar en la posicion "+noticias.length;
text="<a href=# onclick=editar('"+noticias.length+"')>"+noticias[noticias.length-1].replace("[br]"," ").slice(0,20)+"</a><br>";
document.getElementById('lista').innerHTML+=text;
}
function editar(n){
document.forms['fff']['noticia'].value=noticias[n-1].replace("[br]","\r\n");
}
</script></head>
<body>
<form name="fff"><textarea name="noticia" cols="20" rows="20" ></textarea>
<input name="Almacenar" type="button" value="Almacenar en la posicion 1" onclick="almacenar(this.form)">
<br>
Editar Noticias Almacenadas:<br>
<span id="lista"></span>
</form></body>
</html>

saludos
__________________
by Capitán Buscapina
.