Copy code code as follows:
<html>
<head>
<title>Unt titled document</title>
<script type="text/javascript">
function aa()
{{
s=form1.t1.value;
s=s.replace(//n|/r/g,"");// Add g is a global replacement, and if you don't add it, just replace the first one is a carriage return and a newline character.
form1.t1.value=s;
}
</script>
</head>
<body>
<form name="form1">
<textarea name="t1" style="height: 74px"></textarea>
<input type="button" value="aa" onclick="aa()">
</form>
</body>
</html>