2012-12-30 68 views

回答

2

楠來自var dayEvent = dayEvent + myFirstJSON[i].ID + ' ';在您使用dayEvent初始化之前(未定義+一些給你NAN)。如果你初始化,NaN的消失

var dayEvent = ''; 
for (var i = 0; i < myFirstJSON.length; i++) { 
    dayEvent = dayEvent + myFirstJSON[i].ID + ' '; 
} 

http://jsfiddle.net/2DTX8/4/

0

你需要用它來定義的dayEvent開始前的初始值:

var dayEvent = ""; 
for (var i = 0; i < myFirstJSON.length; i++) { 
    dayEvent = dayEvent + myFirstJSON[i].ID + ' '; 
} 

document.writeln(dayEvent);