X
xhe
I met a very headache problem in javascript, I think this might be
difference between IE and NS / Safari.
I have a text area
<form>
<textarea name='tex1' onkeyup='displayit();'></textarea>
</form>
<span id="txtValue"></span>
<script language='javascript'>
function displayit()
{
document.getElementById("txtValue").innerHTML=document.forms[0].tex1.value;
}
</script>
This is a very simple program.
When I run in IE, and no problem, line break in the textares changed
to <br> in the span tag, and line changed automatically.
Problem here is when I run it in Netscape and Safari, the line break
in textarea does not change to <br>, and all the text in the textares
are displayed in one paragraph.
Can anyone tell me how to display the multi-line paragraph contents
of the textarea in the <span> innerHTML correctly to have <br>
there? This is only for NS and Safari. Maybe this is their bugs?
Thanks.
Please email me at (e-mail address removed)
difference between IE and NS / Safari.
I have a text area
<form>
<textarea name='tex1' onkeyup='displayit();'></textarea>
</form>
<span id="txtValue"></span>
<script language='javascript'>
function displayit()
{
document.getElementById("txtValue").innerHTML=document.forms[0].tex1.value;
}
</script>
This is a very simple program.
When I run in IE, and no problem, line break in the textares changed
to <br> in the span tag, and line changed automatically.
Problem here is when I run it in Netscape and Safari, the line break
in textarea does not change to <br>, and all the text in the textares
are displayed in one paragraph.
Can anyone tell me how to display the multi-line paragraph contents
of the textarea in the <span> innerHTML correctly to have <br>
there? This is only for NS and Safari. Maybe this is their bugs?
Thanks.
Please email me at (e-mail address removed)