2012-03-10 40 views
0

這裏是我的代碼:符合條件時不使用驗證。

function getTable(strExp){ 
this.strExp = strExp; 
console.log(strExp); 
var strTBL = ""; 
if (strExp === "Res"){ 
    for (var it = 0; it > 3; it++){ 
    strTBL = strTBL + jsonData.Table.ResTBL[it]; 
    console.log("Im in"); 
    } 
} 
else if (valeur === "Dice"){ 
} 
return strTBL; 
} 

在我的劇本我這樣做呼叫:的document.getElementById( 「ResTBL」)的innerHTML = getTable( 「RES」)

當我看到我的控制檯日誌我沒有看到我在日誌中,但它給了我strExp的價值。

回答

4

只需將it < 3在一個週期

for (var it = 0; it < 3; it++) { 
    strTBL = strTBL + jsonData.Table.ResTBL[it]; 
    console.log("Im in"); 
} 
+0

我覺得這樣不好...讀寫困難症是編碼時,扯淡! – Delarn 2012-03-10 16:43:39