html - HTML 标记属性值内的换行符

标签 html mailto line-breaks subject

如何在 HTML 属性值中插入换行符,如下所示:

<href="mailto:info@example.com?subject=TestMail&body=Please enter the following details.
Name
Email
Mob No">

当用户回复时,正文部分应显示如下:

Please enter the following details.
1. Name
2. Email
3. Mob No

我尝试使用 <br>标签,但它们会显示出来。

最佳答案

换行符应该被 URL 编码成 %0D%0A

您的 mailto 看起来像:

    <a href="mailto:xxx@example.com?subject&body=1.Name%0D%0A2.Email">mailme</a>

信息来自 http://www.cubetoon.com/2008/how-to-enter-line-break-into-mailto-body-command/

关于html - HTML 标记属性值内的换行符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10502256/

相关文章:

javascript - Html5 block 上传在 Chrome 25 中不起作用?

安卓 : Simple web application crashes on links other then the http scheme

javascript - 以编程方式实例化 mailto

JavaScript 正在将\n 转换为\r\n

javascript - HTML 5 Div 位置

html - 如何像谷歌为其官方博客做这种css3动画

javascript - 滑动面板,如何复制它们?

javascript - mailto 潜力 - 我可以用它做什么?

ios - UItextview 自动换行,带有排除路径(swift)

C++ 代码断行,看在我的份上,我无法修复它