<style>
#display br.added
{
display:none;
}
#display>br.added
{
display:block;
}
</style>
<textarea cols=20 rows=10 id="comments"></textarea>
<br>
<button onclick="format()">display below</button>
<br>
<div id="display"></div>
<script>
function format()
{
var comm = document.getElementById("comments").value;
//comm = comm.replace(/<br>.\n/g,"\n").replace(/<br\/>.\n/g,"\n");
comm = comm.replace(/\n/g,"<br class='added'/>");
document.getElementById("display").innerHTML = comm;
}
</script>
|