1.html文件
<div id="detail"></div>
2.JS文件
var detail='<table class="formTable" border="0" cellspacing="0" cellpadding="0" style="padding:0px; 808px; margin-top:20px; border-bottom:1px solid #dddddd;">'; detail+="<tr style='display:block; margin-bottom:-20px;'><td style=' 162px; border-left:1px solid #dddddd;border-top:1px solid #dddddd; height:30px;background-color:#ACD6FF;'> 客户名称:</td><td style=' 602px; border-left:1px solid #dddddd;border-top:1px solid #dddddd;border-right:1px solid #dddddd; height:30px;'> "+name+"</td></tr>"; detail+="<tr style='display:block; margin-bottom:-20px;'><td style=' 162px; border-left:1px solid #dddddd;border-top:1px solid #dddddd; height:30px;background-color:#ACD6FF;'> 手机号:</td><td style=' 602px; border-left:1px solid #dddddd;border-top:1px solid #dddddd;border-right:1px solid #dddddd; height:30px;'> "+mobile+"</td></tr>"; detail+="<tr style='display:block; margin-bottom:-20px;'><td style=' 162px; border-left:1px solid #dddddd;border-top:1px solid #dddddd; height:30px;background-color:#ACD6FF;'> 证件号:</td><td style=' 602px; border-left:1px solid #dddddd;border-top:1px solid #dddddd;border-right:1px solid #dddddd; height:30px;'> "+certNo+"</td></tr>"; detail+="<tr style='display:block; margin-bottom:-20px;'><td style=' 162px; border-left:1px solid #dddddd;border-top:1px solid #dddddd; height:30px;background-color:#ACD6FF;'> 标的名称:</td><td style=' 602px; border-left:1px solid #dddddd;border-top:1px solid #dddddd;border-right:1px solid #dddddd; height:30px;'> "+goodName+"</td></tr>"; detail+="<tr style='display:block; margin-bottom:-20px;'><td style=' 162px; border-left:1px solid #dddddd;border-top:1px solid #dddddd; height:30px;background-color:#ACD6FF;'> 车牌号码:</td><td style=' 602px; border-left:1px solid #dddddd;border-top:1px solid #dddddd;border-right:1px solid #dddddd; height:30px;'> "+plateNum+"</td></tr>"; detail+="<tr style='display:block; margin-bottom:-20px;'><td style=' 162px; border-left:1px solid #dddddd;border-top:1px solid #dddddd; height:30px;background-color:#ACD6FF;'> 保证金:</td><td style=' 602px; border-left:1px solid #dddddd;border-top:1px solid #dddddd;border-right:1px solid #dddddd; height:30px;'> "+bailPrice+"</td></tr>"; detail+="<tr style='display:block; margin-bottom:-20px;'><td style=' 162px; border-left:1px solid #dddddd;border-top:1px solid #dddddd; height:30px;background-color:#ACD6FF;'> 成交金额:</td><td style=' 602px; border-left:1px solid #dddddd;border-top:1px solid #dddddd;border-right:1px solid #dddddd; height:30px;'> "+price+"</td></tr>"; detail+="<tr style='display:block; margin-bottom:-20px;'><td style=' 162px; border-left:1px solid #dddddd;border-top:1px solid #dddddd; height:30px;background-color:#ACD6FF;'> 佣金及其他费用:</td><td style=' 602px; border-left:1px solid #dddddd;border-top:1px solid #dddddd;border-right:1px solid #dddddd; height:30px;'> "+commison+"</td></tr>"; // detail+="<tr style='display:block; margin-bottom:-20px;'><td style=' 162px; border-left:1px solid #dddddd;border-top:1px solid #dddddd; height:30px;'> 总货款:</td><td style=' 602px; border-left:1px solid #dddddd;border-top:1px solid #dddddd;border-right:1px solid #dddddd; height:30px;'> "+totalPrice+"</td></tr>"; detail+="<tr style='display:block; margin-bottom:-20px;'><td style=' 162px; border-left:1px solid #dddddd;border-top:1px solid #dddddd; height:30px;background-color:#ACD6FF;'> 需支付金额:</td><td style=' 602px; border-left:1px solid #dddddd;border-top:1px solid #dddddd;border-right:1px solid #dddddd; height:30px;' id='payPrice'> "+payPrice+"</td></tr>"; detail+="<tr style='display:block; margin-bottom:-20px;'><td style=' 162px; border-left:1px solid #dddddd;border-top:1px solid #dddddd; height:30px;background-color:#ACD6FF;'> 剩余待支付金额:</td><td style=' 602px; border-left:1px solid #dddddd;border-top:1px solid #dddddd;border-right:1px solid #dddddd; height:30px;color:red;' id='surplusPayPrice'> "+payPrice+"</td></tr>"; detail += '</table>'; document.getElementById('detail').innerHTML = detail;
其中包括,设置背景色和字体颜色效果(蓝色标识)
3.效果图