如何将这段div用js的方式拼接html? 5
<divstyle="width:47.5%;float:left;height:550px;overflow-y:auto;"id="menu"><c:forEachi...
<div style="width:47.5%;float:left;height:550px;overflow-y: auto;" id="menu">
<c:forEach items="${productLists}" var="productLists" varStatus="status">
<c:if test="${status.count%2==1}">
<div style="display: flex;">
<a href="#" style="border: 1px solid #bdc1c3; width: 49.5%;height: 100px;">
<div style="display: flex;" onclick="addshop(${productLists.productId},'${productLists.productLogo}','${productLists.productName}',${productLists.productSmoney})">
<img src="/shop/layuiadmin/imgProduct/${productLists.productLogo}" style="width: 80px;height: 80px;margin: 9px;">
<div style="margin-left: 10px;margin-top: 10px;">
<p style="">${productLists.productName}</p>
<p style="color: #02a496;margin-top: 10px;">${productLists.productSmoney}</p>
<p style="color: #02a496; margin-left: 133px; margin-top: 15px;">单规格:</p>
</div>
</div>
</a>
</c:if>
<c:if test="${status.count%2==0}">
<a href="#" style="border: 1px solid #bdc1c3; width: 49.5%;height: 100px;">
<div style="display: flex;" onclick="addshop(${productLists.productId},'${productLists.productLogo}', '${productLists.productName}', ${productLists.productSmoney})">
<img src="/shop/layuiadmin/imgProduct/${productLists.productLogo}" style="width: 80px;height: 80px;margin: 9px;">
<div style="margin-left: 10px;margin-top: 10px;">
<p style="">${productLists.productName}</p>
<p style="color: #02a496;margin-top: 10px;">${productLists.productSmoney}</p>
<p style="color: #02a496; margin-left: 133px; margin-top: 15px;">单规格:</p>
</div>
</div>
</a>
</div>
</c:if>
</c:forEach>
</div> 展开
<c:forEach items="${productLists}" var="productLists" varStatus="status">
<c:if test="${status.count%2==1}">
<div style="display: flex;">
<a href="#" style="border: 1px solid #bdc1c3; width: 49.5%;height: 100px;">
<div style="display: flex;" onclick="addshop(${productLists.productId},'${productLists.productLogo}','${productLists.productName}',${productLists.productSmoney})">
<img src="/shop/layuiadmin/imgProduct/${productLists.productLogo}" style="width: 80px;height: 80px;margin: 9px;">
<div style="margin-left: 10px;margin-top: 10px;">
<p style="">${productLists.productName}</p>
<p style="color: #02a496;margin-top: 10px;">${productLists.productSmoney}</p>
<p style="color: #02a496; margin-left: 133px; margin-top: 15px;">单规格:</p>
</div>
</div>
</a>
</c:if>
<c:if test="${status.count%2==0}">
<a href="#" style="border: 1px solid #bdc1c3; width: 49.5%;height: 100px;">
<div style="display: flex;" onclick="addshop(${productLists.productId},'${productLists.productLogo}', '${productLists.productName}', ${productLists.productSmoney})">
<img src="/shop/layuiadmin/imgProduct/${productLists.productLogo}" style="width: 80px;height: 80px;margin: 9px;">
<div style="margin-left: 10px;margin-top: 10px;">
<p style="">${productLists.productName}</p>
<p style="color: #02a496;margin-top: 10px;">${productLists.productSmoney}</p>
<p style="color: #02a496; margin-left: 133px; margin-top: 15px;">单规格:</p>
</div>
</div>
</a>
</div>
</c:if>
</c:forEach>
</div> 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询