【 tulaoshi.com - Javascript 】
obj_year.innerText=parseInt(num_year)+1; //年数增加
displayCalendar(obj_month.innerText-1,obj_year.innerText);
}
function plusyear()
{
var obj_year=document.getElementById("year");
var obj_month=document.getElementById("month");
var num_year=obj_year.innerText;
obj_year.innerText=parseInt(num_year)-1; //年数减少
displayCalendar(obj_month.innerText-1,obj_year.innerText);
}
function addmonth()
{
var obj_month=document.getElementById("month");
var obj_year=document.getElementById("year");
if(parseInt(obj_month.innerText)=12) //月数增加到12时,年数相应增加1,月数从1开始
{
obj_month.innerText="0";
obj_year=document.getElementById("year");
var num_year=obj_year.innerText;
obj_year.innerText=parseInt(num_year)+1;
}
var num_month=obj_month.innerText;
obj_month.innerText=parseInt(num_month)+1; //月数增加
displayCalendar(obj_month.innerText-1,obj_year.innerText);
}
function plusmonth()
{
var obj_month=document.getElementById("month");
var obj_year=document.getElementById("year");
if(parseInt(obj_month.innerText)<=1) //月数减少到1时,年数相应减少1,月数从12开始
{
obj_month.innerText="13";
obj_year=document.getElementById("year");
var num_year=obj_year.innerText;
obj_year.innerText=parseInt(num_year)-1;
}
var num_month=obj_month.innerText;
obj_month.innerText=parseInt(num_month)-1; //月数减少