我填充所有月份頁面上的「分裂」,例如:fullCalendar - 遺漏的類型錯誤:無法調用的不確定
<?php foreach(range(0,11) as $month): ?>
<div style='float:left; width:303px;' id='calenderSalesMonth_<?php echo $month ?>' class='calenderSales'></div>
<?php endforeach; ?>
fullCalendar
應通過id='calenderSalesMonth_*'
設置特定的月份,它是行不通的,我得到一個錯誤:
Uncaught TypeError: Cannot call method 'split' of undefined
代碼:
$('.calenderSales').fullCalendar({
editable: false,
events: { url: 'calender-events.php' },
firstDay:1,
month: $(this).attr("id").split("_")[1],
year: 2013
});
如果'.attr( 「ID」)'收益不確定的,你不能叫'.split'就可以了,因爲'.split'是一個String對象的方法,不能在未定義時調用。 – 2013-03-23 11:36:40
這個代碼在一些'click'事件處理程序中嗎? – dfsq 2013-03-23 11:36:58
@dfsq不,它不是。 – 2013-03-23 11:39:23