我创建了一个标签<p id="email" >
,其中包含许多<br/>
标签。问题是,如果我将其转换为电子邮件模板,它只会变成一行。任何解决此问题的建议?谢谢
这是我的代码。
HTML代码:
<div class="center">
<div class="centerchild">
<h3 class="headernote">Note Template</h3>
<div class="centerchild">
<p id="demo"></p>
</div>
</div>
<div class="centerchild">
<h3 class="headernote">Email Template</h3>
<div class="centerchild">
<p id=" subline"></p>
</div>
<div class="centerchild">
<p id="email"></p>
</div>
</div>
JavaScript代码:
var _selectedarraynote = doctemplate[_template]
var _selectedarrayemail = docemail[_template]
var _note = 0;
var text = "";
while (_selectedarraynote[_note]) {
text += _selectedarraynote[_note] + "<br>";
_note++;
}
var _email = 1;
var textemail = "";
while (_selectedarrayemail[_email]) {
textemail += _selectedarrayemail[_email] + "<br />";
_email++;
}
var _sub = 0;
var subemail = "";
while (_selectedarrayemail[_sub]) {
subemail += _selectedarrayemail[_sub] + "<br/>";
_sub--;
}
document.getElementById("demo").innerHTML = text;
document.getElementById("email").innerHTML = textemail;
document.getElementById("subline").innerHTML = subemail;
在网络中,这是输出:
Service Reference Number:
Member's Name:
Provider's Name:
Provider's Cell Phone Number:
Provider's Office Phone Number:
Provider's Title:
Time Provider Submitted the Request:
Provider's Time Zone:
How is this Provider involved in the care of this member?
但是当我将其转换为电子邮件时,只有一行。
Service Reference Number:test Member's Name: Provider's Name: Provider's Cell Phone Number: Provider's Office Phone Number: Provider's Title: Time Provider Submitted the Request: Provider's Time Zone: Preferred Timeframe range and date: How is this Provider involved in the care of this member?