Bootstrap报表切换年月日datetimepicker

 
  
时间
时间
时间
$(function(){
	$("#div1").show();
	$("#div2").hide();
	$("#div3").hide();
	$(".form_datetime").datetimepicker({
		language:  'zh-CN', 
		format: 'yyyy-mm-dd',//显示格式
		todayHighlight: 1,//今天高亮
		minView: "month",//设置只显示到月份
		startView:2,
		forceParse: 0,
		showMeridian: 1,
		autoclose: 1//选择后自动关闭
		});
	$(".form_datetime2").datetimepicker({
		language:  'zh-CN', 
		format: 'yyyy-mm',//显示格式
		todayHighlight: 1,//今天高亮
		minView: 3,//设置只显示到月份
		startView:4,
		forceParse: 0,
		showMeridian: 1,
		autoclose: 1//选择后自动关闭
		});
	$(".form_datetime3").datetimepicker({
		language:  'zh-CN', 
		format: 'yyyy',//显示格式
		todayHighlight: 1,//今天高亮
		minView: 4,//设置只显示到月份
		startView:4,
		forceParse: 0,
		showMeridian: 1,
		autoclose: 1//选择后自动关闭
		});
	
});
function changeTime(num){
	switch(num){
	case 1:$("#timeMin").val($("#timeMin1").val());break;
	case 2:$("#timeMax").val($("#timeMax1").val());break;
	case 3:$("#timeMin").val($("#timeMin2").val());break;
	case 4:$("#timeMax").val($("#timeMax2").val());break;
	case 5:$("#timeMin").val($("#timeMin3").val());break;
	case 6:$("#timeMax").val($("#timeMax3").val());break;
	}
}
function clearDate()
{
	$("#timeMin").val('');
	$("#timeMax").val('');
	$("#timeMin1").val('');
	$("#timeMax1").val('');
	$("#timeMin2").val('');
	$("#timeMax2").val('');
	$("#timeMin3").val('');
	$("#timeMax3").val('');
}

function switchDate(num){
	var switchDay= $("#switchDay");
	var switchMonth= $("#switchMonth");
	var switchYear= $("#switchYear");
	clearDate();
	$("#timeType").val(num);
	switch(num){
	case 1:
		switchDay.css("background-color","#cccccc");
		switchMonth.css("background-color","#ffffff");
		switchYear.css("background-color","#ffffff");
		$("#div1").show();
		$("#div2").hide();
		$("#div3").hide();
		break;
	case 2:
		switchDay.css("background-color","#ffffff");
		switchMonth.css("background-color","#cccccc");
		switchYear.css("background-color","#ffffff");
		$("#div1").hide();
		$("#div2").show();
		$("#div3").hide();
		break;
	case 3:
		switchDay.css("background-color","#ffffff");
		switchMonth.css("background-color","#ffffff");
		switchYear.css("background-color","#cccccc");
		$("#div1").hide();
		$("#div2").hide();
		$("#div3").show();
		break;
	}
	search();
}
 
 

你可能感兴趣的:(js)