`

JS日历选择插件二

    博客分类:
  • JS
阅读更多

JS代码
var Calendar = function( instanceId, language, startYear, endYear ){
	if( typeof instanceId == "string" ){
		this.Date  	= new Date();
		this.Year  	= this.Date.getFullYear();
		this.Month 	= this.Date.getMonth();
		this.Week	= this.Date.getDay();
		this.Today	= this.Date.getDate();
		
		this.InstanceId = instanceId;
		this.Language	= language 	|| 1;
		this.StartYear	= startYear || this.Year - 20;
		this.EndYear	= endYear 	|| this.Year + 1;
		
		// If instance is input[type='text'] object
		this.popContainer_id =  'popCalendarContainer';
		
		// Message store
		this.msgStore = [];
		
		this.caleContainer_id = 'calendarContainer';
		this.caleTop = {
			today_view_id:		'calendarTodayView',
			week_view_id:		'calendarWeekView',
			lq_year_id:			'linkQuickYear',
			lq_month_id:		'linkQuickMonth',
			sq_year_id:			'selectQuickYear',
			sq_month_id:		'selectQuickMonth',
			close_id:			'calendarClose',
			prev_month_id:		'toPrevMonth',
			back_today_id:		'backToday',
			next_month_id:		'toNextMonth'
		}
		this.daysContainer_id = 'calendarDaysContainer';
		this.msgContainer_id = 'calendarTipsContainer';
		
		this.curDayClass = 		'calendarCurrentDay';
		this.tipDayClass =		'calendarTipDay';
		this.oldTipDayClass =	'calendarOldTipDay';
	}
};
/* Calendar language */
Calendar.lang = {
  weeks:  	[
  				["星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
  				["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
  			],        
  weeksMenu:[
	 			["日","一","二","三","四","五","六"],
	       		["SUN","MON","TUR","WED","THU","FRI","SAT"]
          	]
};
/* Create calendar element */
Calendar.prototype._getViewElement = function(){
	// Create page html element
	var caleElem = "";
		// Create Start
		caleElem+= '<div id='+this.caleContainer_id+'>';
		
		// <Top>
		caleElem+= '<div id="calendarTopContainer"><table cellpadding="0" cellspacing="0"><tr>';
		
		// Top day view
		caleElem+= '<td id='+this.caleTop.today_view_id+'></td>';
		
		// Link or select control
		caleElem+= '<td>';
		caleElem+= '<div id='+this.caleTop.week_view_id+'></div>';
		caleElem+= '<table id="calendarYearMonthContainer" cellpadding="0" cellspacing="0">';
		caleElem+= '<tr>';
		caleElem+= '<td>';
		caleElem+= '<a id='+this.caleTop.lq_year_id+' href="javascript:void(0);"></a>';
		caleElem+= '<select id='+this.caleTop.sq_year_id+'></select>';
		caleElem+= '</td>';
		caleElem+= '<td>.</td>';
		caleElem+= '<td>';
		caleElem+= '<a id='+this.caleTop.lq_month_id+' href="javascript:void(0);"></a>';
		caleElem+= '<select id='+this.caleTop.sq_month_id+'></select>';
		caleElem+= '</td>';
		caleElem+= '</tr>';
		caleElem+= '</table>';
		caleElem+= '</td>';
		
		// Quick control
		caleElem+= '<td>';
		caleElem+= '<div id="calendarCloseContainer">';
		caleElem+= '<a id='+this.caleTop.close_id+' href="javascript:void(0);">x</a>';
		caleElem+= '</div>';
		
		caleElem+= '<div id="calendarQuickContainer">';
		caleElem+= '<a id='+this.caleTop.prev_month_id+' href="javascript:void(0);">&laquo;</a>';
		caleElem+= '<a id='+this.caleTop.back_today_id+' href="javascript:void(0);">&nbsp;</a>';
		caleElem+= '<a id='+this.caleTop.next_month_id+' href="javascript:void(0);">&raquo;</a>';
		caleElem+= '</div>';
		caleElem+= '</td>';
		
		caleElem+= '</tr></table cellpadding="0" cellspacing="0"></div>';
		// </Top>
		
		// <Calendar View>
		caleElem+= '<div id="calendarMainContainer">';
		// Week menu
		caleElem+= '<div id="calendarWeeksContainer">';
		for(var i = 0; i < 7; i ++){
		caleElem+= '<span>'+Calendar.lang["weeksMenu"][this.Language][i]+'</span>';
		}
		caleElem+= '</div>';
		
		// Days view
		caleElem+= '<table id='+this.daysContainer_id+' cellpadding="0" cellspacing="0">';
		for(var tr = 0; tr < 6; tr ++){
		caleElem+= '<tr>';
		for(var td = 0; td < 7; td ++){
		caleElem+= '<td><span></span></td>';
		}
		caleElem+= '</tr>';
		}
		caleElem+= '</table>';
		
		caleElem+= '</div>';
		// </Calendar View>

		caleElem+= '</div>';
		
		caleElem+= '<div id='+this.msgContainer_id+'></div>';
		
	return caleElem;
};
/* Get Month Data */
Calendar.prototype._getMonthViewArray = function( year, month ){
	var monthArray = [];
	// From the beginning day of the week
	var beginDayOfWeek = new Date( year, month, 1).getDay();
	
	// This month total days
	var daysOfMonth = new Date( year, month + 1, 0).getDate();
	
	// 42: 7*6 matrix 
	for( var i = 0; i < 42; i ++ )
	  monthArray[i] = "&nbsp;";
	  
	for( var j = 0; j < daysOfMonth; j ++ )
		monthArray[j + beginDayOfWeek] = j + 1 ;
		
	return monthArray;
};
/* Search the index of option in the select */
Calendar.prototype._getOptionIndex = function( selectObject, value ){
	for( var j = 0; j < selectObject.options.length; j ++ ){
		if( value == selectObject.options[j].value )
			return j;
	}
};
/* Bind year data into 'Year select' */
Calendar.prototype._bindYearIntoSelect = function(){
	var oYear = this.find( this.caleTop.sq_year_id );
	var oYearLen = 0;
	for( var i = this.StartYear; i <= this.EndYear; i ++, oYearLen ++ )
		oYear.options[oYearLen] = new Option( i , i );
};
/* Bind Month data into 'Month select' */
Calendar.prototype._bindMonthIntoSelect = function(){
	var oMonth = this.find( this.caleTop.sq_month_id );
	var oMonthLen = 0;
	for( var i = 0; i < 12; i ++, oMonthLen ++ )
		oMonth.options[oMonthLen] = new Option( i + 1 , i + 1 );
};
/* Bind data */
Calendar.prototype._bindAllData = function( curYear, curMonth ){
	var cr = this;
	// Bind default Data into 'select:Year' 
	this._bindYearIntoSelect();
	
	// Bind default Data into 'select:Month'
 	this._bindMonthIntoSelect();
 	
	// Change the 'select:Year' and 'select:Month' value 
	this.changeSelectValue( curYear, curMonth );
 	
 	// Bind default data into 'current day view and current week view'
	this.find( this.caleTop.week_view_id ).innerHTML  = Calendar.lang['weeks'][this.Language][this.Week];
	this.find( this.caleTop.today_view_id ).innerHTML = this.Today;
 	
 	// Get days and bind into 'CalendarMain'
	// Add current day class and mouse event
 	var daysOfMonthArray = this._getMonthViewArray( curYear, curMonth );
	var spans = this.find( this.daysContainer_id, "span" );
	var curYMD = this.Year + "" + ( this.Month + 1 ) + "" + this.Today;
	var selectYear  = this.find( this.caleTop.sq_year_id ).value;
	var selectMonth = this.find( this.caleTop.sq_month_id ).value;
	for( var i = 0; i < spans.length; i ++ ){
		spans[i].innerHTML = daysOfMonthArray[i];
		var selectYMD = selectYear + "" + selectMonth + "" + spans[i].innerHTML;
		if( curYMD == selectYMD )
			spans[i].className = this.curDayClass;
		else
			spans[i].className = "";
	}
	// If not some days has pop message
	if( this.msgStore != "" )
		this._initPopMsg( this.msgStore );
}
/* Bind event */
Calendar.prototype._bindAllEvent = function(){
	var cr = this;
	// 'toPrevMonth, toNextMonth, backToday, today view' event
	this.find( this.caleTop.prev_month_id ).onclick = function(){ cr.goPrevOrNextMonth(this); };
	this.find( this.caleTop.next_month_id ).onclick = function(){ cr.goPrevOrNextMonth(this); };
	this.find( this.caleTop.back_today_id ).onclick	= function(){ cr.backToday(); };
	this.find( this.caleTop.today_view_id ).onclick = function(){ cr.backToday(); };
	
	// 'year and month select' onchange event
	this.find( this.caleTop.sq_year_id ).onchange   = function(){ cr.updateSelect(); };
	this.find( this.caleTop.sq_month_id ).onchange	= function(){ cr.updateSelect(); };
	
	// Quick link event
	this.find( this.caleTop.lq_year_id ).onclick  = function(){ 
		cr.showHide( cr.caleTop.lq_year_id, "none" );
		cr.showHide( cr.caleTop.sq_year_id, "block" );
	};
	this.find( this.caleTop.lq_month_id ).onclick = function(){ 
		cr.showHide( cr.caleTop.lq_month_id, "none" );
		cr.showHide( cr.caleTop.sq_month_id, "block" );
	};
	
	// Remove the link dotted line
	var oLink = this.find( this.caleContainer_id, "a" )
	for( var i = 0; i < oLink.length; i ++ ){
		oLink[i].onfocus  = function(){ this.blur(); }
	}
}
/* Bind calendar for calendar view */
Calendar.prototype._initCalendar = function(){
	this._bindAllEvent();
	this._bindAllData( this.Year, this.Month );
};
/* Change the quick select value */
Calendar.prototype.changeSelectValue = function( year, month ){
	var ymArray = [], selectArray = [], linkArray = [];
	// Store the 'year' and 'month' to Array
	ymArray[0] = year; ymArray[1] = month + 1;
	
	// Store the 'selectYear_id' and 'selectMonth_id' to Array
	selectArray[0] = this.caleTop.sq_year_id; selectArray[1] = this.caleTop.sq_month_id;
	
	linkArray[0] = this.caleTop.lq_year_id; linkArray[1] = this.caleTop.lq_month_id;
	
	for( var i = 0; i < selectArray.length; i ++ ){
		var selectObject = this.find( selectArray[i] );
		// Get the return index
		var index = this._getOptionIndex( selectObject, ymArray[i] );
		// Reset the 'year', 'month' select and link value
		selectObject.options[index].selected = "selected";
		
		this.find( linkArray[i] ).innerHTML = selectObject.value;
	}
	
	this.resetLinkSelect();
};
/* Search next or previons month */
Calendar.prototype.goPrevOrNextMonth = function( obj ){
	var curMonthSelect = this.find( this.caleTop.sq_month_id );
	var curMonth = parseInt( curMonthSelect.value );
	var curYear  = this.find( this.caleTop.sq_year_id ).value;
	// If 'next' get current month select + 1
	// If 'prev' get current month select - 1
	if( obj.id == this.caleTop.next_month_id )
		curMonthSelect.value = curMonth + 1;
	else
		curMonthSelect.value = curMonth - 1;
		
	var getNowMonth = curMonthSelect.value - 1;
	if( getNowMonth == -1 && curMonth == 1) 	getNowMonth = 0;
	if( getNowMonth == -1 && curMonth == 12 ) 	getNowMonth = 11;
	
	this._bindAllData( curYear, getNowMonth );
};
/* If 'select:Year' and 'select:Month' change value update data  */
Calendar.prototype.updateSelect = function(){
	var yearSelectValue	 = this.find( this.caleTop.sq_year_id ).value;
	var monthSelectValue = this.find( this.caleTop.sq_month_id ).value;
	// Re-bind Panel Data
	this._bindAllData( yearSelectValue, monthSelectValue - 1 );
	
};
/* Back to taday: re-load '_bindAllData()' */
Calendar.prototype.backToday = function(){
	this._bindAllData( this.Year, this.Month );
};
/* Find the instance object or children of instance object by Id */
Calendar.prototype.find = function( elemId, childTag ){
	if( !childTag )
		// Return: object
		return document.getElementById( elemId );
	else
		// Return: object array
		return this.find( elemId ).getElementsByTagName( childTag );
};
/* Set element css */
Calendar.prototype.css = function( oId, selector ){
	var o = this.find( oId );
 	selector['left']?o.style.left = selector['left']:"";
 	selector['top']?o.style.top  = selector['top']:"";
 	selector['position']? o.style.position = selector['position']:"";
}
/* Check calendar show or hidden */
Calendar.prototype.showHide = function( objectId, dis ){
	return this.find( objectId ).style.display = dis;
};
/* Init the top quick menu link and select */
Calendar.prototype.resetLinkSelect = function(){
	this.showHide( this.caleTop.sq_year_id, "none" );
	this.showHide( this.caleTop.sq_month_id, "none" );
	this.showHide( this.caleTop.lq_year_id, "block" );
	this.showHide( this.caleTop.lq_month_id, "block" );
};
/* Put this calendar into the html of instance */
Calendar.prototype.show = function( msgData ){
	var obj = this.find( this.InstanceId );
	if( obj ){
		obj.innerHTML = this._getViewElement();
		// Init calendar event and data
		this._initCalendar();
		
		// This function don't have 'close'
		this.showHide( this.caleTop.close_id, "none" );
		if( typeof msgData == 'object'){
			this.msgStore = msgData;
			this._initPopMsg( this.msgStore );
		}
	}
};
/* Init pop message */
Calendar.prototype._initPopMsg = function(){
	var cr = this;
	var selectYear  = this.find( this.caleTop.sq_year_id ).value;
	var selectMonth = this.find( this.caleTop.sq_month_id ).value;
	var daysOfMonthArray = this._getMonthViewArray( selectYear, selectMonth );
	var spans = this.find( this.daysContainer_id, "span" );
	for( var key in this.msgStore ){
		var keyMD = key.substring( 4 );
		var keyY  = key.substring( 0, 4 );
		for( var i = 0; i < spans.length; i ++){
			var getMD = selectMonth + "" + spans[i].innerHTML;
			if( getMD == keyMD ){
				if( selectYear == keyY )
					spans[i].className = this.tipDayClass +" "+ keyY;
				else
					spans[i].className = this.oldTipDayClass +" "+ keyY;	
				spans[i].onmouseover = function(){
					var hoverDate = this.className.split(" ")[1] + "" + selectMonth + "" + this.innerHTML;
					var y = this.className.split(" ")[1],
						m = selectMonth,
						d = this.innerHTML;
					cr.find( cr.msgContainer_id ).innerHTML = cr._getMsgHtml( y, m, d );
					cr.showHide( cr.msgContainer_id, "block" );
				}
			}
		}
	}
	cr.find( cr.caleContainer_id ).onmouseout = function(){
		cr.showHide( cr.msgContainer_id, "none" );
	}
};
/* Get message */
Calendar.prototype._getMsgHtml =function( y, m, d ){
	var date = y + m + d;
	var showDate = y + "-" + m + "-" + d;
	var msgHtml = '<div>'+showDate+':</div><div>'+ this.msgStore[date] +'</div>';
	return msgHtml;
}
/* Pop-up the calendar */
Calendar.prototype.pop = function(){
	var cr = this;
	var obj	= this.find( this.InstanceId );
	if( obj ){
		// Instance object click then pop-up the calendar
		obj.onclick = function( e ){
			var e = window.event || e;
			var x  = e.x || e.pageX,
				y  = e.y || e.pageY;
			if( !cr.find( cr.popContainer_id ) ){
				// Create the pop-up div
				var oDiv = document.createElement("div");
				oDiv.id  = cr.popContainer_id;
				document.body.appendChild( oDiv );
			}else{
				cr.showHide( cr.popContainer_id, "block" );
			}
			cr.find( cr.popContainer_id ).innerHTML = cr._getViewElement();
			
			// Init calendar event and data
			cr._initCalendar();
			
			// Set days click event
			cr.popDaysClickEvent( obj );
			
			// Set position
			cr.css( cr.popContainer_id, {position: "absolute", left: x + "px", top: y + "px"});
			
			// Close panel event
			cr.find( cr.caleTop.close_id ).onclick = function(){ cr.showHide( cr.popContainer_id, "none" ); };
		};
	}
};
/* Click the pop calendar days event [For INPUT] */
Calendar.prototype.popDaysClickEvent = function( obj ){
	var cr = this;
	var spans = cr.find( cr.daysContainer_id, "span" );
	for( var i = 0; i < spans.length; i ++ )
		spans[i].onclick = function(){
			if( this.innerHTML != "&nbsp;" ){
				var getYear	 = cr.find( cr.caleTop.sq_year_id ).value;
				var getMonth = cr.find( cr.caleTop.sq_month_id ).value;
				obj.value = getYear +"-"+ getMonth +"-" + this.innerHTML;
				cr.showHide( cr.popContainer_id, "none" );
			}
		}
};
 JSP代码
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>日历选择插件(IE和火狐都行)</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">

		<script type="text/javascript" src="calendar2.js"></script>
		<link rel="stylesheet" type="text/css" href="calendar.css"></link>
		<script type="text/javascript">
			window.onload = function() {
			var cr = new Calendar("t");
			cr.pop();
			}
		</script>
		<style type="text/css">
		body,ul {
			margin: 0;
			padding: 0;
			list-style-type: none;
		}
		</style>
	</head>

	<body>
		<form action="" method=post>
			<table>
				<tr>
					<td>
						<div id="c" style="padding: 50px;">
							<input id="t">

						</div>
					</td>
				</tr>
			</table>

		</form>


		</div>
	</body>
</html>
 CSS代码
#calendarTopContainer tr td{
	vertical-align: top;
}
#popCalendarContainer{
	opacity: 0.88;
	filter: alpha(opacity=88);
}
#calendarContainer{
	font: normal 12px arial, helvetica, sans-serif;
	border: #1D99C9 1px solid;
	width: 210px;
	display: block;
}
/* top */
#calendarTopContainer{
	width: 210px;
	height: 36px;
	background-color: #33B1E1;
	overflow: hidden;
}
#calendarTodayView{
	font: bold 32px arial, helvetica, sans-serif;
	color: #FFF;
	width: 60px;
	height: 36px;
	text-align: center;
	cursor: pointer;
}
#calendarDateView{
	width: 100px;
	height: 36px;
}
#calendarWeekView,
#calendarYearMonthContainer{
	font: normal 12px arial, helvetica, sans-serif;
	height: 18px;
	overflow: hidden;
	color: #FFF;
}
#calendarWeekView{
	width: 100px;
	height: 14px;
	padding-top: 4px;
	text-indent: 3px;
	*height: 18px;
	*padding-top: 5px;
}
#linkQuickYear,
#linkQuickMonth{
	padding: 0 3px;
	height: 18px;
	line-height: 18px;
	text-decoration: none;
	color: #FFF;
}
#linkQuickYear:hover,
#linkQuickMonth:hover{
	color: #FFFF80;
}
#calendarYearMonthContainer select{
	font: normal 12px arial, helvetica, sans-serif;
	color: #FFF;
	border: #33B1E1 1px solid;
	display: none;
	background-color: #33B1E1;
}
/* Modeify By http://www.codefans.net */
#calendarCloseContainer,
calendarQuickContainer{
	height: 18px;
}
#calendarCloseContainer{
	width: 47px;
	height: 12px;
	margin-top: 3px;
}
#calendarClose{
	font: bold 14px arial, helvetica, sans-serif;
	width: 12px;
	height: 12px;
	line-height: 10px;
	color: #FFF;
	background: #1D9BCB;
	border: #7DDAFB 1px solid;
	text-align: center;
	float: right;
	display: block;
	text-decoration: none;
	*padding: 0 2px 2px 2px;
}
#calendarClose:hover{
	color: #7DDAFB;
}
#calendarQuickContainer{
	height: 10px;
	margin-top: 4px;
	float: right;
}

#toPrevMonth,
#toNextMonth,
#backToday{
	font: bold 14px arial, helvetica, sans-serif;
	float: left;
	width: 8px;
	height: 10px;
	line-height: 10px;
	font-size: 14px;
	color: #FFF;
	overflow: hidden;
	display: block;
	_display: inline;
}
#backToday{
	height: 8px;
	margin: 3px 8px 0 8px;
	background: #fff;
}
#toPrevMonth:hover,
#toNextMonth:hover{
	color: #D9E4F2;
}
#backToday:hover{
	background-color: #D9E4F2;
}

/* Main */
#calendarMainContainer{
	width: 210px;
	background-color: #FFF;
}
#calendarWeeksContainer{
	height: 20px;
	background-color: #D9E4F2;
	border-bottom: #1D99C9 1px solid;
	border-top: #1D99C9 1px solid;
}
#calendarWeeksContainer span{
	width: 30px;
	height: 20px;
	color: #003366;
	text-align: center;
	display: inline-block;
	padding-top: 3px;
}
#calendarDaysContainer tr td{
	width: 30px;
	height: 20px;
	text-align: center;
	cursor: text;
	font: normal 12px arial, helvetica, sans-serif;
	overflow: hidden;
}
#calendarDaysContainer tr td span{
	cursor: default;
	display: block;
	_text-align: center;
}

#calendarTipsContainer{
	position: absolute;
	display: none;
	overflow: hidden;
	width: 198px;
	padding: 3px 6px;
	line-height: 18px;
	font: normal 12px arial, helvetica, sans-serif;
	background-color: #f7f7f7;
	color: #666;
	border: #1D99C9 1px solid;
	border-top-style: none;
	*width: 212px;
}
/* current day, has tip days style */
.calendarCurrentDay{
	font-weight: bold;
	border: #cb0000 1px solid;
	background-color: #FF0000;
	color: #FFF;
}
.calendarTipDay{
	border: #999 1px solid;
	background-color: #FFFFDD;
	color: #666;
}
.calendarOldTipDay{
	border: #ccc 1px solid;
	background-color: #f7f7f7;
	color: #888;
}
 效果

 

  • 大小: 15.5 KB
分享到:
评论

相关推荐

    html js脚本日历控件

    7. **兼容性**:考虑到浏览器的多样性,编写JavaScript日历控件时需要关注跨浏览器的兼容性问题,确保在不同的浏览器(如Chrome、Firefox、Safari、Edge和IE)上都能正常工作。 在提供的文件名中,"calendar.html"...

    js日历选择控件

    My97 DatePicker 是一个非常流行的JavaScript日历插件,它功能强大,自定义选项丰富,支持多种语言,并且在各种浏览器上都有良好的兼容性。本文将详细介绍My97 DatePicker 的使用方法及其核心特性。 首先,我们来看...

    6个JS日历控件个JS日历控件

    JavaScript(JS)日历控件是网页开发中常用的一种组件,用于展示日期选择功能,通常在表单中作为输入辅助工具出现。它们可以提供用户友好的界面,方便用户选择日期,而无需手动输入。以下是对JS日历控件的一些详细...

    JS日历选择器控件.zip

    "JS日历选择器控件.zip" 提供的是一款基于JavaScript实现的日历选择器,它允许用户在输入日期时通过点击文本框来弹出一个日历视图,方便用户选择日期。这样的功能常见于各种表单、预订系统或时间安排应用中,提高了...

    jquery calendar.js日历选择控件带节日日历选择器

    总之,`jQuery Calendar.js`是一款实用的日历插件,适用于需要日期选择功能的网页应用。它的节日功能使得在处理日期相关事务时更加直观和有趣。通过简单的配置和调用,开发者可以轻松地将这款日历控件整合到自己的...

    js日历控件日历插件

    js日历控件日历插件 如何使用已写在js文本里,欢迎下载!

    原生js layDate日历控件多款日历选择器样式代码下载

    layDate是一款由layui团队开发的高效、轻量且功能丰富的原生JavaScript日历插件,它提供了多种日历选择器样式,适用于各种网页场景。在这款控件中,开发者可以轻松实现日期选择、日期时间选择、年月选择、时间选择等...

    js日历DIV控件

    JS日历DIV控件是一种使用JavaScript实现的轻量级日历组件,它通过在页面上动态创建一个可浮动的DIV元素来展示日历,用户可以选择日期并将其值返回到页面上的特定输入元素。 **1. JS基础知识** JavaScript(简称JS...

    js日历 控件 集合

    本文将深入探讨“js日历控件集合”这一主题,旨在为你提供多种js日历插件的选择和使用方法。 1. **基础概念** 日历控件是网页应用中的一种组件,它以日历的形式呈现日期,用户可以通过点击或滑动来选择特定日期。...

    3款简洁的JS日历插件.rar

    3款简洁的JS日历插件,实现网页上的JavaScript日历选择功能,内含有详细的调用说明,上手容易,附带有文档。calendar1调用方法:引入script src="js/calendarDateInput.js" 在calendardateinput.js修改图片的路径。

    js日历控件自主选择颜色

    【标题】"js日历控件自主选择颜色" 涉及的核心技术是JavaScript日历插件的开发,尤其强调用户可以根据个人喜好自定义颜色。这样的控件在网页设计中非常常见,主要用于处理与日期相关的交互,如日期选择、预约系统、...

    原生js日历选择器插件.rar

    原生JavaScript日历选择器插件是一种无需依赖任何外部库,仅使用JavaScript、CSS和HTML构建的日期选择工具。这种插件在网页开发中非常实用,可以为用户提供一个直观、友好的日期输入界面,尤其适用于表单填写或者...

    js日历控件优化

    这里我们将深入探讨如何优化JavaScript日历控件,特别是那些包含时分秒选择,以及支持年月日显示的组件。 1. **性能优化**:在创建日历控件时,减少DOM操作是关键。利用虚拟DOM或仅在必要时更新DOM可以显著提升性能...

    js日历控件 js日历控件

    JavaScript日历控件是网页开发中常用的一种交互元素,它允许用户在网页上方便地选择日期,常用于表单输入、事件安排或者时间相关的功能。本文将深入探讨JavaScript日历控件的实现原理、常见库及其应用。 1. **基本...

    JS 日历组件(功能很强) javascript 日历控件 日历选择空间 日期选择 强烈推荐

    "My97DatePicker"是一个知名的JavaScript日历插件,因其丰富的功能和良好的用户体验而被广泛使用。 My97DatePicker是由中国开发者杨佳97开发的,它不仅提供了基本的日期选择功能,还包含了多种高级特性,使得它成为...

    js 日历控件 calendar 漂亮日历控件

    总之,JavaScript日历控件是一个结合了前端技术与用户体验设计的组件,通过JavaScript的动态特性,我们可以创建功能丰富、用户友好的日期选择工具。在实际项目中,还可以考虑与其他库(如jQuery、React或Vue)集成,...

    一个简单实用的JS/JQuery日历选择控件

    本文将深入探讨“一个简单实用的JS/JQuery日历选择控件”的知识点,结合给出的标签“源码”和“工具”,我们可以推断这是一个关于自定义日历插件的教程或示例。 首先,日历选择控件是网页应用中常见的一种组件,...

    JavaScript日历控件 六种日历

    JavaScript日历控件是网页开发中常用的一种交互元素,它能帮助用户方便地选择日期,常见于表单输入、事件安排或时间相关的功能。在给定的资源中,包含了六种不同样式的JavaScript日历,这些日历可能具有不同的设计...

    JS日历插件日期选择器

    "JS日历插件日期选择器"是JavaScript技术在网页开发中的一种常见应用,它允许用户在网页上方便地选择日期,提升用户体验并简化数据输入。 该插件的主要功能包括: 1. **日期选择**:提供一个可视化的日历界面,...

    JS日历控件(可以选择多个日期)

    在JavaScript(JS)中,日历控件是一种常见的交互元素,用于用户友好地选择日期。在许多Web应用程序中,特别是那些涉及到日期输入的场景,如预订系统、日程管理等,这种控件非常实用。本篇文章将深入探讨如何创建一...

Global site tag (gtag.js) - Google Analytics