Is \\n
the universal newline character sequence in Javascript for all platforms? If not, how do I determine the character for the current environment?
I
you can use <br/>
and the document.write/
, document.writeln
one.
Email link function i use "%0D%0A"
function sendMail() {
var bodydata="Before "+ "%0D%0A";
bodydata+="After"
var MailMSG = "mailto:aaa@sss.com"
+ "?cc=07@sss.com"
+ "&subject=subject"
+ "&body=" + bodydata;
window.location.href = MailMSG;
}
[HTML]
<a href="#" onClick="sendMail()">Contact Us</a>
Yes, it is universal.
Although '\n'
is the universal newline characters, you have to keep in mind that, depending on your input, new line characters might be preceded by carriage return characters ('\r'
).