早些时候我有滚动条,其中显示不同的图标。单击特定图标后,将显示 jsp 页面。但我需要用轮播替换它。
在下一个/上一个单击时,应调用以下函数:
function testing(index) {
var tableLength = tableAddArray.length;
for (var i = 0; i < tableLength; i++) {
if (i == index) {
selectedElement= tableAddArray[i].id;
}
console.log("selectedElement:: "+selectedElement);
}
createElement();
}
function createElement() {
var request ="/xyzz/abcdd?objectName=";
var attributesToSend = "&action=add" ;
attributesToSend += "&ref="+document.getElementsByName("ref")[0].value ;
document.getElementsByName("action")[0].value = "add";
if (selectedElement != null) { request += selectedElement;
if (selectedElement == "1") {equest += "&condOp=5"; }
else if (selectedElement == "2") {request += "&dest=2";}
request += attributesToSend; location.href=request;
//from here other processing is done to get corresponding data from DB
}
}
然后在轮播中:
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel" data-interval="false">
<div class="carousel-inner">
<div class="carousel-item">
<c:choose>
<c:when test="${requestScope.objectName == '2'}">
<jsp:include page="2nd_Slide.jsp"></jsp:include> </c:when>
<c:when test="${requestScope.objectName == '3'}">
<jsp:include page="3rd_slide.jsp"></jsp:include> </c:when>
</c:choose>
</div>
<a class="carousel-control-prev" ..>
<a class="carousel-control-next" ..>
</div>
因此我还需要在第 0 个索引处设置 objectname 。我不知道在轮播的第 0 张幻灯片显示之前如何调用 js。
森林海
相关分类