if (_this.tiles["suz:SuzukiHubResponse"]["suz:categories"][category][aspect]["suz:image"][imageNo] != undefined) {
if (imageNo > (_this.tiles["suz:SuzukiHubResponse"]["suz:categories"][category][aspect]["suz:image"].length - 1)) {
imageNo = 0;
_this.categoriesCurrentImage[categoryIndex] = imageNo;
}
var img = _this.tiles["suz:SuzukiHubResponse"]["suz:categories"][category][aspect]["suz:image"][imageNo];
_this.showImage(img, divId);
_this.categoriesCurrentImage[categoryIndex]++;
_this.categoryIndex++;
} else {
if (imageNo > (_this.tiles["suz:SuzukiHubResponse"]["suz:categories"][category][aspect]["suz:image"].length - 1)) {
imageNo = 0;
_this.categoriesCurrentImage[categoryIndex] = imageNo;
}
var img = _this.tiles["suz:SuzukiHubResponse"]["suz:categories"][category][aspect]["suz:image"];
_this.showImage(img, divId);
_this.categoriesCurrentImage[categoryIndex]++;
_this.categoryIndex++;
}
誰能告訴我爲什麼。如果語句是真的,代碼去其他地方?
我最終在else子句中,即使if爲真? 這對我來說絕對沒有意義。
如果在suz:image節點下面有超過1個圖像,它應該落入else中。它有99%的時間。
你的代碼格式不。解決這個問題,這個錯誤應該變得更加明顯。 – zzzzBov
使用一些更多變量來使代碼更易於閱讀和調試。例如,把var img = _this.tiles [「suz:SuzukiHubResponse」] [「suz:categories」] [category] [aspect] [「suz:image」];更高,並在適當的測試中使用它。 –