0
我使用的是完整的日曆jQuery的成分,我想通過申報單的循環要添加的事件太..但它不工作..每個循環事件添加到完整的日曆
這裏是JavaScript代碼.. 的註釋行,在代碼中添加時有問題..
$(document).ready(function() {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
$('#calendar').fullCalendar({
editable: true,
events: [
//$("div.allEvents").each(function (index){ when I add this to the Jquery code .. it doesn't work
{
//title: $(this).children('#event').val(), replace this by the next line
title: $('#event').val(),
//start: new Date(y, m, $(this).children('#date').val()) replace this by the next line
start: new Date(y, m, $('#date').val())
},
//}); End of each loop
]
});
});
,這裏是CSS和HTML代碼..
<div class="allEvents">
<input type='hidden' id='event' value='Alaa' />
<input type='hidden' id='date' value='21' />
</div>
<div class="allEvents">
<input type='hidden' id='event' value='Waheeb' />
<input type='hidden' id='date' value='29' />
</div>
<style type='text/css'>
body {
margin-top: 40px;
text-align: center;
font-size: 14px;
font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
}
#calendar {
width: 900px;
margin: 0 auto;
}
這是另一種方式。但在代碼中,Ghost只需要將'events:[code]'改成'events:function(st,en,cb){var events []; <> cb(events);}' –
MaxD