js中动态加载---append

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了js中动态加载---append相关的知识,希望对你有一定的参考价值。

$(‘#Order_information‘).append(‘
<div class="single_product">
<div class="Cancel">
<a href="javascript:void(0);" onclick="continuePay(‘+orderno+‘,‘+useId+‘);">继续支付</a>
<a href="javascript:void(0);" onclick="cancelOrder(‘+orderno+‘,‘+useId+‘);">取消订单</a>
</div>
<ul class="Top_mation">
<li>订单编号: <span class="indent_number">‘+data[i].baseinfor.orderno+‘</span></li>
<li class="right">状态: <span class="mode">‘+orderstate+‘</span></li>
</ul>
<div class="Middle_mation" onclick="showOrderDetail(‘+orderno+‘,‘+useId+‘);">
<a href="javascript:void(0);"><img src="‘+urlpath+‘/views/quicksure/imags/car.png"></a>
<ul>
<li><h3>汽车保险</h3></li>
<li>车牌号: <span class="Car_number">‘+data[i].vhlinfor.lcnno+‘</span></li>
<li>
商业险起期:<span class="begin_date">‘+data[i].baseinfor.sypolicystartdate+‘</span>&nbsp;&nbsp;&nbsp;&nbsp;
交强险起期:<span class="begin_date">‘+data[i].baseinfor.jqpolicystartdate+‘</span>
</li>
<li>
商业险止期:<span class="end_date">‘+data[i].baseinfor.sypolicyenddate+‘</span>&nbsp;&nbsp;&nbsp;&nbsp;
交强险止期:<span class="end_date">‘+data[i].baseinfor.jqpolicyenddate+‘</span>
</li>
</ul>
<b>〉</b>
</div>
<p>金额: <span class="money">‘+data[i].baseinfor.totalPremium+‘</span></p>
</div>‘);

 

 

function addPolicyInfo(insuranceDetailsVO,orderstate){
var orderno="‘"+insuranceDetailsVO.baseinfor.orderno+"‘";
var useId="‘"+insuranceDetailsVO.baseinfor.userinforid+"‘";
var order_info = $(‘#Order_information‘);
var sp_div = $(‘<div class="single_product"/>‘);
sp_div.append($(‘<ul class="Top_mation"/>‘).append(‘<li class="left">订单编号: <span class="indent_number">‘+insuranceDetailsVO.baseinfor.orderno+‘</span></li class="right"><li class="right">状态: <span class="mode">‘+orderstate+‘</span></li>‘));
var mm_div = $(‘<div class="Middle_mation" onclick="showOrderDetail(‘+orderno+‘,‘+useId+‘);"/>‘);
mm_div.append(‘<a href="#"><img src="‘+urlpath+‘/views/quicksure/imags/carLogo.jpg" style="width:110px;height:98px;"/>‘);
var sp_ul = $(‘<ul/>‘).append(‘<li>车牌号: <span class="Car_number">‘+insuranceDetailsVO.vhlinfor.lcnno+‘</span>&nbsp;&nbsp;车主:<span>‘+insuranceDetailsVO.vhlinfor.drvowner+‘</span></li>‘);
if(insuranceDetailsVO.baseinfor.sypolicystartdate != null){
sp_ul.append($(‘<li>商业险起期:<span class="begin_date">‘+insuranceDetailsVO.baseinfor.sypolicystartdate.slice(0,11)+‘</span></li>‘));
}
if(insuranceDetailsVO.baseinfor.sypolicyenddate != null){
sp_ul.append($(‘<li>商业险止期:<span class="end_date">‘+insuranceDetailsVO.baseinfor.sypolicyenddate.slice(0,11)+‘</span></li>‘));
}
if(insuranceDetailsVO.baseinfor.jqpolicystartdate != null){
sp_ul.append($(‘<li>交强险起期:<span class="begin_date">‘+insuranceDetailsVO.baseinfor.jqpolicystartdate.slice(0,11)+‘</span></li>‘));
}
if(insuranceDetailsVO.baseinfor.jqpolicyenddate != null){
sp_ul.append($(‘<li>交强险止期:<span class="end_date">‘+insuranceDetailsVO.baseinfor.jqpolicyenddate.slice(0,11)+‘</span></li>‘));
}
mm_div.append(sp_ul).append(‘<b>〉</b>‘);
sp_div.append(mm_div);
var p = $(‘<p/>‘);
if(insuranceDetailsVO.baseinfor.orderstate==30||insuranceDetailsVO.baseinfor.orderstate==40){
p.append(‘<a href="#" onclick="continuePay(‘+orderno+‘,‘+useId+‘);">继续支付</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" onclick="cancelOrder(‘+orderno+‘,‘+useId+‘);">取消订单</a>&nbsp;&nbsp;&nbsp;&nbsp;‘);
}
if(insuranceDetailsVO.baseinfor.orderstate==10||insuranceDetailsVO.baseinfor.orderstate==20){
p.append(‘<a href="#" onclick="continueInsure(‘+orderno+‘,‘+useId+‘);">继续投保</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" onclick="cancelOrder(‘+orderno+‘,‘+useId+‘);">取消订单</a>&nbsp;&nbsp;&nbsp;&nbsp;‘);
}
p.append(‘金额: <span class="money">‘+insuranceDetailsVO.baseinfor.totalPremium+‘</span>‘);
sp_div.append(p);
order_info.append(sp_div);
}





























































以上是关于js中动态加载---append的主要内容,如果未能解决你的问题,请参考以下文章

JQuery 之 动态加载JS或JS文件

JS动态append之后点击事件无效

iframe每个页面加载css js

如何在js文件中动态加载另一个js文件?

如何动态加载js文件

如何在js文件中动态加载另一个js文件?