The code I wrote as follows, don't know what's the problem, always show don't come out? A great god, please give directions!!!!!
{" content ":" top-up CARDS, "
"Time" : "17-09-08"
},
{" content ":" millet hand ring, "
"Time" : "17-03-12"
},
{" content ":" IPTV, "
"Time" : "18-01-02"
}
];
The function fu (arr) {
Var STR="";
For (I=0, len=arr. Length; i
STR +='& lt; Div & gt; '+ arr [I] content +' & lt;/div> ';
STR +='& lt; Div & gt; '+ arr [I] time +' & lt;/div> ';
STR +='& lt;/div> ';
}
}
Document. GetElementById (" box "). The innerHTML=fu (reobj);
</script>
CodePudding user response:
Fu function finally add:Return the STR;
CodePudding user response:
The function fu (arr) {Var STR="";
For (I=0, len=arr. Length; i
STR +='& lt; Div & gt; '+ arr [I] content +' & lt;/div> ';
STR +='& lt; Div & gt; '+ arr [I] time +' & lt;/div> ';
STR +='& lt;/div> ';
}
return STR.
}
CodePudding user response:
The function fu (arr) {
Var STR="";
for(i=0; iSTR +='& lt; Div & gt; ';
STR +='& lt; Div & gt; '+ arr [I] content +' & lt;/div> ';
STR +='& lt; Div & gt; '+ arr [I] time +' & lt;/div> ';
STR +='& lt;/div> ';
Return the STR;//must add the ah, the document. The getElementById (" box "). The innerHTML=fu (reobj); The return value,
}
CodePudding user response:
STR in a function, the scope is only in this way, you can remove the var in front of, thus become a global variable, can call, or in your method returns a STRCodePudding user response:
function fu (arr) {
Var STR="";
for(i=0; iSTR +='& lt; Div & gt; ';
STR +='& lt; Div & gt; '+ arr [I] content +' & lt;/div> ';
STR +='& lt; Div & gt; '+ arr [I] time +' & lt;/div> ';
STR +='& lt;/div> ';
}
Return the STR;//which have inside the for loop return ah, 3 floor of brother die
Which have inside the for loop return ah, 3 floor of brother die
Which have inside the for loop return ah, 3 floor of brother die
Which have inside the for loop return ah, 3/f brother die