script language="javascript">
var r= "1/n2/n3/n";
//Replace the letter /n with a semicolon
alert(r.replace("/n",";"));
Result: 1;2/n3/n only replaces the first one
</script>
<script language="javascript">
var r= "1/n2/n3/n";
//Replace the letter /n with a semicolon
alert(r.replace(//n/g, ";"));
Result: 1;2;3; The first parameter of replace can be a regular expression, and /g indicates full-text matching.
</script>