最精致的日历式日期输入控件

2016-01-29 11:37 62 1 收藏

最精致的日历式日期输入控件,最精致的日历式日期输入控件

【 tulaoshi.com - Javascript 】

<HTML
<HEAD
<TITLE最精致的日历式日期输入控件 (Smart Ver 1.00)</TITLE
</HEAD
<style
body
{
 font-size:12px;
 font-family:"Tahoma";
}
td
{
 font-size:12px;
 font-family:"Tahoma";
}
.inputdate
{
 border:1px solid #7287c6;
 text-align: center;
 font-size: 12px;
 font-style: normal;
 height: 16px;
}
</style
<SCRIPT LANGUAGE="JavaScript"
<!--
/********************************************************************
more javascript from http://www.smallrain.net
时间:2004-01-01
作者:Smart
功能:日历式日期选择控件
 
参数:
说明:
1.输入框直接调用用以下代码
<ScriptDateBox("InputName","DateValue")</Script
其中:InputName 为输入日期的文本框.注:不能为空.
       DateValue  为输入日期的文本框默认日期值.格式为:YYYY-MM-DD.如2004-01-01
                       此值可以不填或为空.则默认值为当天日期.(客户端)
2.其它"按钮"调用用以下代码
CallDate("InputName")
其中:InputName 为输入日期的文本框.注:不能为空.
修改区
时间:
修改人:
原因:
********************************************************************/
/*基本参数*/
var Frw=106; //日历宽度
var Frh=137; //日历高度
var Frs=4;     //影子大小
var Hid=true;//日历是否打开
/*创建框架*/
document.writeln('<Div id=Calendar Author=smart  scrolling="no" frameborder=0 style="border:0px solid #EEEEEE ;position: absolute; width: '+Frw+'; height: '+Frh+'; z-index: 0; filter :'progid:DXImageTransform.Microsoft.Shadow(direction=135,color=#AAAAAA,strength='+Frs+')' ;display: none"</Div');
/*取得今日日期*/
function GetTodayDate()
{
   today= new Date();
   y= today.getYear();
   m= (today.getMonth() + 1);
   if (m<10)
   {
     m='0'+m;
   }
   d= today.getDate();
   if (d<10)
   {
     d='0'+d;
   }
return y+'-'+m+'-'+d
}
/*输入今天日期*/
function SetTodayDate(InputBox)
{
  HiddenCalendar();
  InputBox.value=GetTodayDate();
}
/*取某年某月第一天的星期值(月份-1)*/
function GetFirstWeek(The_Year,The_Month)
{
  return (new Date(The_Year,The_Month-1,1)).getDay()
}
/*取某年某月中总天数*/
function GetThisDays(The_Year,The_Month)
{
  return (new Date(The_Year,The_Month,0)).getDate()
}
/*取某年某月上个月中总天数*/
function GetLastDays(The_Year,The_Month)
{
  return (new Date(The_Year,The_Month-1,0)).getDate()
}
/*判断是否是闰年*/
function RunNian(The_Year)
{
 if ((The_Year%400==0) || ((The_Year%4==0) && (The_Year%100!=0)))
  return true;
 else
  return false;
}
/* 判断日期(YYYY-MM-DD)的日期是否正确 */
function DateIsTrue(asDate){
 var lsDate  = asDate + "";
 var loDate  = lsDate.split("-");
 if (loDate.length!=3) return false;
 var liYear  = parseFloat(loDate[0]);
 var liMonth = parseFloat(loDate);
 var liDay   = parseFloat(loDate);
 if ((loDate[0].length4)||(loDate.length2)||(loDate.length2)) return false;
 if (isNaN(liYear)||isNaN(liMonth)||isNaN(liDay)) return false;
 if ((liYear<1800)||(liYear2500)) return false;
 if ((liMonth12)||(liMonth<=0))   return false;
 if (GetThisDays(liYear,liMonth)<liDay) return false;
 return !isNaN(Date.UTC(liYear,liMonth,liDay));
}
/*取某年某月的周值*/
function GetCountWeeks(The_Year,The_Month)
{
 var Allday;
 Allday = 0;
 if (The_Year2000)
 {
&nbs

来源:https://www.tulaoshi.com/n/20160129/1482807.html

延伸阅读
标签: Web开发
HTML HEAD TITLE日期选择器/TITLE SCRIPT type="text/javascript" /** * 返回日期 * @param d the delimiter * @param p the pattern of your date * @author  Xinge(修改) */ String.prototype.toDate = function(x, p) { &n...
标签: Web开发
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
标签: 电脑入门
方法一、excel快速输入当前日期 你只需在Excel的单元格中按就可以了,注意分号(;)必须是半角英文的,这时就会自动出现当前(今天)日期了,输入当前日期为,冒号也是半角英文的哦。 方法二、excel快速输入其他日期 你在Excel中如果要输入其他日期,你可以按一般的日期格式输入,例如:2012/8/8或者是2012-8-8就可以了。 方法三、excel输入年...
标签: Web开发
Input {font-family: verdana;font-size: 9pt;text-decoration: none;background-color: #FFFFFF;height: 20px;border: 1px solid #666666;color:#000000;} .Calendar {font-family: verdana;text-decoration: none;width: 170;background-color: #C0D0E8;font-size: 9pt;border:0px dotted #1C6FA5;}.CalendarTD {font-family: verdana...
标签: excel
excel怎么插入日历控件   excel怎么插入日历控件? 1、首先,打开Excel 2007软件,然后在表格的最左上角有一个office按钮,然后鼠标右键点击,如图。然后在弹出的对话框选择自定义快速访问工具栏 2、接着在弹出的EXCEL选项对话框最左侧选择自定义,然后将常用命令改为下拉菜单中的不在功能区中的命令,然后在此命...

经验教程

23

收藏

92
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部