mailto onclick中的换行符 [英] Line break in the mailto onclick
问题描述
下面的代码效果很好,除了电子邮件的所有文字都在一行上,如下所示:
身高:60 |对角线:123 |宽度:107 |总SF:13.92 |每SF成本:450 |总费用:$ 6,264.00
The code below works great except the email has all the text on one line like this: Height: 60 | Diagonal: 123 | Width: 107 | Total SF: 13.92 | Cost Per SF: 450 | Total Cost: $6,264.00
我想在每次之后休息所以看起来像这样:
I would like to break after each so it looks like this:
高度:60
对角线:123
宽度:107
总SF:13.92
每SF成本:450
总费用:$ 6,264.00
Height: 60
Diagonal: 123
Width: 107
Total SF: 13.92
Cost Per SF: 450
Total Cost: $6,264.00
我试过了\ n \r \ n \\\等但是他们都没有工作。有什么想法吗?
I tried \n \r \n\r etc but none of them work. Any ideas?
<a class="emailText" href="mailto:?subject=Screen Dimensions" onclick="this.href='mailto:?subject=Screen Dimensions&body='+'Height: '+document.forms.myform.high.value+' | '+'Diagonal: '+document.forms.myform.diagonal.value+' | '+'Width: '+document.forms.myform.wide.value+' | '+'Total SF: '+document.forms.myform.sf.value+' | '+'Cost Per SF: '+document.forms.myform.csf.value+' | '+'Total Cost: '+document.forms.myform.tc.value">Email</a>
推荐答案
您需要使用ASCII值换行/回车:
You need to use the ASCII values for line feed/carriage return:
%0A = \n
%0D = \r
%0D%0A = \r\n
像魅力一样工作。
<a href="mailto:person@somedomain.com?subject=My subject&body=Hello %0D%0A World">Link</a>
(为了清晰起见,在%0D%0A附近添加了空格。实际上,这可能会增加不需要的空白区域。 )
(Spaces added around %0D%0A for clarity. In reality, this could add unwanted white space.)
这篇关于mailto onclick中的换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!