Когда vesselCount
2 код выполняется только один раз он не входит в цикл сноваFor Loop не работает должным образом Javascript
function showAllProducts(type, vesselIndex, prodCount,vesselCount) {
confirm (type+"==="+vesselIndex+"===="+prodCount);
for(i=0;i<vesselCount;i++) {
confirm("outerfor"+vesselCount);
vesselIndex=vesselIndex+i;
var tableId = "";
if(type=="regular") {
tableId = "productsTable"+vesselIndex;
confirm ("productsTable"+vesselIndex);
} else {
tableId = "productsTableCompV"+vesselIndex;
}
var productsTable = document.getElementById(tableId);
var prodCount = productsTable.rows.length-1;
confirm("productcount"+prodCount);
if(prodCount>0) {
var expandUp = "";
var expandDown = "";
if(type == 'regular') {
expandUp = "productExpandUp";
expandDown = "productExpandDown";
} else {
expandUp = "compProductExpandUp";
expandDown = "compProductExpandDown";
}
for(i=0;i<prodCount;i++) {
var div1 = expandDown+vesselIndex+i;
var div2 = expandUp+vesselIndex+i;
showProductDetails(type, vesselIndex, i, div1, div2);
confirm("fordone");
}
}
}
}
...
function showProductDetails(type, vesselIndex, prodIndex, div1, div2){
var applContId = "";
if(type == 'regular') {
applContId = "productApplCont";
} else {
applContId = "compProductApplCont";
}
document.getElementById(applContId+vesselIndex+prodIndex).style.visibility = "visible";
document.getElementById(applContId+vesselIndex+prodIndex).style.display = "block";
var jobType = document.getElementById("jobType").value;
if(jobType=='INSP' || jobType=='MAR') {
if(type == 'regular') {
document.getElementById("productQuant"+vesselIndex+prodIndex).style.visibility = "visible";
document.getElementById("productQuant"+vesselIndex+prodIndex).style.display = "block";
}
}
document.getElementById(div1).style.visibility = "visible";
document.getElementById(div2).style.visibility = "hidden";
}
Спасибо дружище сделал трюк только изменил внутреннюю varibale петли – user2218550