Share this page 

Have an Alert box with new line in itTag(s): Language


<SCRIPT>
alert("line1\r\nline2\r\nline3");
</SCRIPT>
This tip is also good for inserting new line into a TextArea.

"\r\n" stands for carriage Return and New line. On Netscape, only the \n may be necessary but with Explorer, you need both. To be compatible with both always use the combination "\r\n".