I have the following:
function replace(string,text,by) {
// Replaces text with by in string
var strLength = string.length, txtLength = text.length;
if ((strLength == 0) || (txtLength == 0)) return string;
var i = string.indexOf(text);
if ((!i) && (text != string.substring(0,txtLength))) return string;
if (i == -1) return string;
var newstr = string.substring(0,i) + by;
if (i+txtLength < strLength)
newstr += replace(string.substring(i+txtLength,strLength),text,by);
return newstr;
}
and:
<script language="JavaScript">
document.write(replace(window.opener.document.JobsInput.CompanyProfile.value,'\r','<br>'));
</script>
This replace works in NS4 and IE but not NS6. I am trying to replace all CarraigeReturns with the HTML <br> tag.
Please can anyone help me figure out why NS6 doesn't like this?
Thanks.
KatsKorner
Edited by - kat on 31 October 2001 06:31:18