One line in netscape 7

wxdqz

New Member
I have the below script to change line breaks to '^' character in a text area field, but its not working in netscape 7. While it does change a '^' to '\r\n', it won't change the '\r\n' to '^'. It seems it is not hitting the second while loop - while (tempx.indexOf(outx)>-1) {




<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Untitled</title>


<SCRIPT LANGUAGE="JavaScript">
function changeback() {
if (document.NOAServiceLevelInfo.message) {
var entry = document.NOAServiceLevelInfo.message.value;
var out = "^";
var addd = "\r\n";
var temp = "" + entry;

while (temp.indexOf(out)>-1) {
pos= temp.indexOf(out);
temp = "" + (temp.substring(0, pos) + addd +
temp.substring((pos + out.length), temp.length));
}
document.NOAServiceLevelInfo.message.value = temp;
}
}

function change() {
if ( document.NOAServiceLevelInfo.message ) {
alert ("one");
var entryx = document.NOAServiceLevelInfo.message.value;
outx = "\r\n";
addx = "^";
tempx = "" + entryx;

alert ("two");

while (tempx.indexOf(outx)>-1) {
alert ("three");
posx= tempx.indexOf(outx);
tempx = "" + (tempx.substring(0, posx) + addx +
tempx.substring((posx + outx.length), tempx.length));
}
document.NOAServiceLevelInfo.message.value = tempx;
}
}



</SCRIPT>

</head>

<body>

<form action="" name="NOAServiceLevelInfo" id="NOAServiceLevelInfo">


<input type=hidden name=packit value=http://www.webdeveloper.com/forum/archive/index.php/""><textarea name=message cols=44 rows=6></textarea>

<input type="button" value="change" onclick="change();">
<input type="button" value="change back" onclick="changeback();">

</form>

</body>
</html>
 
Back
Top