SharePoint 2010 滚动三个月日历



嗨,我正在尝试通过在页面中插入三个日历 Web 部件以及在 CEWP 中插入以下代码来开发三个月的滚动日历视图。

日历应分别滚动到上一个或下一个,但单击"上月"和"下个月"按钮。

它似乎只适用于滚动,但有些问题。有人可以帮助我吗?

< script type = "text/javascript" >
$(document).ready(function() {
window.setTimeout(setCal, 1000);
});
var CurrentDate = new Date();
function setCal() {
$("#PrevMonth").click(PrevMonth);
$("#NextMonth").click(NextMonth);
MoveToDate((CurrentDate.getMonth() + 2).toString() + 'u002f' + CurrentDate.getDate().toString() + 'u002f' + CurrentDate.getFullYear().toString(), 'WPQ3');
MoveToDate((CurrentDate.getMonth() + 1).toString() + 'u002f' + CurrentDate.getDate().toString() + 'u002f' + CurrentDate.getFullYear().toString(), 'WPQ2');
MoveToDate((CurrentDate.getMonth()).toString() + 'u002f' + CurrentDate.getDate().toString() + 'u002f' + CurrentDate.getFullYear().toString(), 'WPQ1');
}
function PrevMonth() {
MoveToDate((CurrentDate.getMonth() - 1).toString() + 'u002f' + CurrentDate.getDate().toString() + 'u002f' + CurrentDate.getFullYear().toString(), 'WPQ3');
MoveToDate((CurrentDate.getMonth() - 1).toString() + 'u002f' + CurrentDate.getDate().toString() + 'u002f' + CurrentDate.getFullYear().toString(), 'WPQ2');
MoveToDate((CurrentDate.getMonth() - 1).toString() + 'u002f' + CurrentDate.getDate().toString() + 'u002f' + CurrentDate.getFullYear().toString(), 'WPQ1');
}
function NextMonth() {
MoveToDate((currentMonth + 1).toString() + 'u002f' + CurrentDate.getDate().toString() + 'u002f' + CurrentDate.getFullYear().toString(), 'WPQ3');
MoveToDate((currentMonth + 1).toString() + 'u002f' + CurrentDate.getDate().toString() + 'u002f' + CurrentDate.getFullYear().toString(), 'WPQ2');
MoveToDate((currentMonth + 1).toString() + 'u002f' + CurrentDate.getDate().toString() + 'u002f' + CurrentDate.getFullYear().toString(), 'WPQ1');
}
<
/script>

在这里,经过大量搜索,这非常有效。

<script type="text/javascript" src="http://sharepoint server/sites/page/Scripts/jquery.SPServices.js"></script>
<script src="https://code.jquery.com/jquery-1.11.0.min.js" type="text/javascript"></script>
<script type="text/javascript">
function myPrevFunction() {
document.getElementById("WPQ3_nav_prev_img").click(); 
document.getElementById("WPQ4_nav_prev_img").click();
document.getElementById("WPQ5_nav_prev_img").click(); 
document.getElementById("WPQ6_nav_prev_img").click();
document.getElementById("WPQ7_nav_prev_img").click(); 
document.getElementById("WPQ8_nav_prev_img").click();
}
function myNextFunction() {
document.getElementById("WPQ3_nav_next_img").click(); 
document.getElementById("WPQ4_nav_next_img").click();
document.getElementById("WPQ5_nav_next_img").click(); 
document.getElementById("WPQ6_nav_next_img").click();    
document.getElementById("WPQ7_nav_next_img").click(); 
document.getElementById("WPQ8_nav_next_img").click();
}

</script>
<input type="button" id="CFCCalPrev" value="Prev" onclick="myPrevFunction()">
<input type="button" id="CFCCalNext" value="Next" onclick="myNextFunction()">

最新更新