Errr...actually my regular expression pattern was off. This works for IE 5.5, Netscape
4 and Netscape 6:
var re = /\n/g;
document.myform.ta.value = document.myform.ta.value.replace(re, "<br>");
Of course, if you hit the back button you see all the <br>s so there's probabaly a
better solution out there.
----- Original Message -----
From: Dina Hess
To: CF-Talk
Sent: Saturday, March 23, 2002 9:24 AM
Subject: Re: OT: <textarea> headache...Netscape specific
Jochem,
That worked! Thanks! Here's something strange though:
This works in Netscape 6.1:
document.myform.ta.value = document.myform.ta.value.replace(/[\r\n]/g, "<br>");
And this works in IE 5.5 and Netscape 4:
document.myform.ta.value = document.myform.ta.value.replace(/[\r\n][\r\n]/g, "<br>");
So it looks like some browser sniffing is needed for the complete solution.
Dina
----- Original Message -----
From: Jochem van Dieten
To: CF-Talk
Sent: Saturday, March 23, 2002 9:04 AM
Subject: Re: OT: <textarea> headache...Netscape specific
Dina Hess wrote:
> Javascript gurus,
>
> I thought I'd solved the textarea problem, but when I test my 'solution' in
Netscape 6.1 and Netscape 4, the Javascript is completely ignored!! I don't get it.
>
> Here's what works well in IE 5.5:
>
> <script language="JavaScript" type="text/javascript"><!--
> function replaceTA() {
> myform.ta.value = myform.ta.value.replace(/[\r\n][\r\n]/g, "<br>");
> }
> //-->
> </script>
Try this:
<script language="JavaScript" type="text/javascript">
function replaceTA() {
document.myform.ta.value =
document.myform.ta.value.replace(/[\r\n][\r\n]/g, "<br>");
}
</script>
Jochem
______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists