search
HomeWeb Front-endJS TutorialThe calendar control is available for testing under FF2.0 and ie6_time and date

/***************************************************** *****
* Usage
* The control calls onclick="fPopCalendar(event,this,this)"
* As follows, set the control to readonly
* * size="15" onclick="fPopCalendar(event,this,this)"
* onfocus="this.select()" readonly=" readonly" />
* "
* " If the page is garbled, just put the following definition items containing Chinese characters into the page
****************** ****************************************/
var gMonths=new Array("January","February","March","April","May","June","July ","August","September","October","November","December");
var WeekDay=new Array("日","一","二" ,"三","四","五","六");
var strToday="Today";
var strYear="Year";
var strMonth="Month";
var strDay="day";
var splitChar="-";
var startYear=2000;
var endYear=2050;
var dayTdHeight=12;
var dayTdTextSize=12;
var gcNotCurMonth="#E0E0E0";
var gcRestDay="#FF0000";
var gcWorkDay="#444444";
var gcWeekDay="#990099";
var gcMouseOver= "#79D0FF";
var gcMouseOut="#F4F4F4";
var gcToday="#444444";
var gcTodayMouseOver="#6699FF";
var gcTodayMouseOut="#CCCCFF";
var gdCtrl=new Object();
var goSelectTag=new Array();
var gdCurDate=new Date();
var giYear=curYear=gdCurDate.getFullYear();
var giMonth=curMonth=gdCurDate.getMonth() 1;
var giDay=curDay=gdCurDate.getDate();
function $(){var elements=new Array();for(var i=0;iArray.prototype.Push=function(){var startLength=this.length;for(var i=0;iString.prototype.HexToDec=function(){return parseInt(this,16);}
String .prototype.cleanBlank=function(){return this.isEmpty()?"":this.replace(/s/g,"");}
function checkColor(){var color_tmp=(arguments[0] " ").replace(/s/g,"").toUpperCase();var model_tmp1=arguments[1].toUpperCase();var model_tmp2="rgb(" arguments[1].substring(1,3).HexToDec () "," arguments[1].substring(1,3).HexToDec() "," arguments[1].substring(5).HexToDec() ")";model_tmp2=model_tmp2.toUpperCase();if( color_tmp==model_tmp1 ||color_tmp==model_tmp2){return true;}return false;}
function $V(){return $(arguments[0]).value;}
function fPopCalendar(evt,popCtrl ,dateCtrl){evt.cancelBubble=true;gdCtrl=dateCtrl;var evtDate="";if(document.all){evtDate=evt.srcElement.value;}else{evtDate=evt.currentTarget.value;}var reg= /(^d{4})-([0-1]d)-([0-2]d$)/;if(reg.test(evtDate)){reg.exec();giYear=RegExp.$1 ;giMonth=RegExp.$2;giDay=RegExp.$3;}fSetYearMon(giYear,giMonth);var point=fGetXY(popCtrl);with($("calendardiv").style){left=point.x "px"; top=(point.y popCtrl.offsetHeight 1) "px";visibility='visible';zindex='99';position='absolute';}$("calendardiv").focus();}
function fSetDate(iYear,iMonth,iDay){var iMonthNew=new String(iMonth);var iDayNew=new String(iDay);if(iMonthNew.lengthfunction fHideCalendar(){$("calendardiv").style.visibility="hidden";for (var i=0;ifunction fSetSelected(){var iOffset=0;var iYear=parseInt($("tbSelYear").value);var iMonth=parseInt($("tbSelMonth").value);var aCell=$("cellText" arguments[0]);with(aCell){var iDay =parseInt(innerHTML);if(checkColor(style.color,gcNotCurMonth)){iOffset=(innerHTML>10)?-1:1;}iMonth =iOffset;if(iMonth12){iYear ;iMonth=1;}}fSetDate(iYear,iMonth,iDay);}
function Point(iX,iY){this.x=iX;this.y=iY ;}
function fBuildCal(iYear,iMonth){var aMonth=new Array();for(var i=1;ifunction fDrawCal(iYear,iMonth,iCellHeight,iDateTextSize){var colorTD="background-color:" gcMouseOut ";border-color:" gcMouseOut ";";var styleTD="height:" iCellHeight "px;font-weight:bolder;font-size:" iDateTextSize "px;vertical-align:middle; text-align:center;";var dateCal="";dateCal ="";for(var i=0;i" WeekDay[i] "";}dateCal ="";for(var w=1;w";for(var d=0;d";dateCal ="";dateCal ="";}dateCal ="";}return dateCal;}
function fUpdateCal(iYear,iMonth){var myMonth=fBuildCal(iYear,iMonth);var i=0;for(var w=1;wfunction fCurrentDate(){return curYear strYear curMonth strMonth curDay strDay;}
function fSetYearMon(iYear,iMon){$("tbSelMonth").options[iMon-1].selected=true;for(var i=0;ifunction fPrevMonth(){var iMon=$("tbSelMonth").value;var iYear=$("tbSelYear").value;if(--iMonfunction fNextMonth(){var iMon=$("tbSelMonth").value;var iYear=$("tbSelYear").value;if( iMon>12){iMon=1;iYear ;}fSetYearMon(iYear,iMon);}
function fGetXY(aTag){var oTmp=aTag;var pt=new Point(0,0);do{pt.x =oTmp.offsetLeft;pt.y =oTmp.offsetTop;oTmp=oTmp.offsetParent;}while(oTmp.tagName.toUpperCase()!="BODY");return pt;}
function getDateDiv(){var noSelectForIE="";var noSelectForFireFox="";if(document.all){noSelectForIE="onselectstart='return false;'";}else{noSelectForFireFox="-moz-user-select:none;";}var dateDiv="";dateDiv ="

";dateDiv ="";dateDiv ="";dateDiv ="";dateDiv ="";dateDiv ="";dateDiv ="";dateDiv ="
";dateDiv =" ";dateDiv =" ";dateDiv ="' style='height:20px;width:20px;font-weight:bolder;' onclick='fNextMonth()'>";dateDiv ="
";dateDiv ="
";dateDiv =fDrawCal(giYear,giMonth,dayTdHeight,dayTdTextSize);dateDiv ="
";dateDiv ="
";dateDiv ="" strToday ":" fCurrentDate() "";dateDiv ="
";return dateDiv;}
with(document){onclick=fHideCalendar;write(getDateDiv());}

[Ctrl A 全选 注:如需引入外部Js需刷新才能执行]

日历控件.htm
复制代码 代码如下:


html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


日历控件_脚本之家





<script></script>


      




date.js
复制代码 代码如下:


Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Python vs. JavaScript: The Learning Curve and Ease of UsePython vs. JavaScript: The Learning Curve and Ease of UseApr 16, 2025 am 12:12 AM

Python is more suitable for beginners, with a smooth learning curve and concise syntax; JavaScript is suitable for front-end development, with a steep learning curve and flexible syntax. 1. Python syntax is intuitive and suitable for data science and back-end development. 2. JavaScript is flexible and widely used in front-end and server-side programming.

Python vs. JavaScript: Community, Libraries, and ResourcesPython vs. JavaScript: Community, Libraries, and ResourcesApr 15, 2025 am 12:16 AM

Python and JavaScript have their own advantages and disadvantages in terms of community, libraries and resources. 1) The Python community is friendly and suitable for beginners, but the front-end development resources are not as rich as JavaScript. 2) Python is powerful in data science and machine learning libraries, while JavaScript is better in front-end development libraries and frameworks. 3) Both have rich learning resources, but Python is suitable for starting with official documents, while JavaScript is better with MDNWebDocs. The choice should be based on project needs and personal interests.

From C/C   to JavaScript: How It All WorksFrom C/C to JavaScript: How It All WorksApr 14, 2025 am 12:05 AM

The shift from C/C to JavaScript requires adapting to dynamic typing, garbage collection and asynchronous programming. 1) C/C is a statically typed language that requires manual memory management, while JavaScript is dynamically typed and garbage collection is automatically processed. 2) C/C needs to be compiled into machine code, while JavaScript is an interpreted language. 3) JavaScript introduces concepts such as closures, prototype chains and Promise, which enhances flexibility and asynchronous programming capabilities.

JavaScript Engines: Comparing ImplementationsJavaScript Engines: Comparing ImplementationsApr 13, 2025 am 12:05 AM

Different JavaScript engines have different effects when parsing and executing JavaScript code, because the implementation principles and optimization strategies of each engine differ. 1. Lexical analysis: convert source code into lexical unit. 2. Grammar analysis: Generate an abstract syntax tree. 3. Optimization and compilation: Generate machine code through the JIT compiler. 4. Execute: Run the machine code. V8 engine optimizes through instant compilation and hidden class, SpiderMonkey uses a type inference system, resulting in different performance performance on the same code.

Beyond the Browser: JavaScript in the Real WorldBeyond the Browser: JavaScript in the Real WorldApr 12, 2025 am 12:06 AM

JavaScript's applications in the real world include server-side programming, mobile application development and Internet of Things control: 1. Server-side programming is realized through Node.js, suitable for high concurrent request processing. 2. Mobile application development is carried out through ReactNative and supports cross-platform deployment. 3. Used for IoT device control through Johnny-Five library, suitable for hardware interaction.

Building a Multi-Tenant SaaS Application with Next.js (Backend Integration)Building a Multi-Tenant SaaS Application with Next.js (Backend Integration)Apr 11, 2025 am 08:23 AM

I built a functional multi-tenant SaaS application (an EdTech app) with your everyday tech tool and you can do the same. First, what’s a multi-tenant SaaS application? Multi-tenant SaaS applications let you serve multiple customers from a sing

How to Build a Multi-Tenant SaaS Application with Next.js (Frontend Integration)How to Build a Multi-Tenant SaaS Application with Next.js (Frontend Integration)Apr 11, 2025 am 08:22 AM

This article demonstrates frontend integration with a backend secured by Permit, building a functional EdTech SaaS application using Next.js. The frontend fetches user permissions to control UI visibility and ensures API requests adhere to role-base

JavaScript: Exploring the Versatility of a Web LanguageJavaScript: Exploring the Versatility of a Web LanguageApr 11, 2025 am 12:01 AM

JavaScript is the core language of modern web development and is widely used for its diversity and flexibility. 1) Front-end development: build dynamic web pages and single-page applications through DOM operations and modern frameworks (such as React, Vue.js, Angular). 2) Server-side development: Node.js uses a non-blocking I/O model to handle high concurrency and real-time applications. 3) Mobile and desktop application development: cross-platform development is realized through ReactNative and Electron to improve development efficiency.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.