js带{}的循环问题~
function showdate(obj) {
$('#date').fullCalendar({
editable: true,
events: [
{title: "¥"+obj[0].money,start:new Date(obj[0].year, obj[0].m,obj[0].d), url:'www.xxx..com'},
]
});
}
这部分该
{title: "¥"+obj[0].money,start:new Date(obj[0].year, obj[0].m,obj[0].d), url:'http://www.xxxx.com/'},
如何实现循环
------解决方案--------------------for in遍历
------解决方案--------------------JScript code
<script>
var obj = {
a: 1,
b: 2,
c: 3
};
for(var x in obj){
alert( x+':'+obj[x] )
}
</script>
------解决方案--------------------
for (var i = 0, len = events.lenght; i < len; i++) {
for (var name in events[i]) {
alert(name + ' : ' + events[i][name]);
}
}
------解决方案--------------------
------解决方案--------------------
------解决方案--------------------