WebContent/resource/js/calendar.js

(开头部分) 20KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<!--
var cal;
var isFocus=false; //是否为焦点
function SelectDate(obj,strFormat)
{
    var date = new Date();
    var by = date.getFullYear()-50;  //最小值 → 50 年前
    var ey = date.getFullYear()+50;  //最大值 → 50 年后
    //cal = new Calendar(by, ey,1,strFormat);    //初始化英文版,0 为中文版
    cal = (cal==null) ? new Calendar(by, ey, 0) : cal;    //不用每次都初始化 2006-12-03 修正
    cal.dateFormatStyle = strFormat;
    cal.show(obj);
}
/**//**//**//**
 * 返回日期getFullYear
 * @param d the delimiter
 * @param p the pattern of your date
 2006-06-25修改为根据用户指定的 style 来确定;
 此控件由寒羽枫同志提供。
 */
//String.prototype.toDate = function(x, p) {
String.prototype.toDate = function(style) {
/**//**//**//*
  if(x == null) x = "-";
  if(p == null) p = "ymd";
  var a = this.split(x);
  var y = parseInt(a[p.indexOf("y")]);
  //remember to change this next century ;)
  if(y.toString().length <= 2) y += 2000;
  if(isNaN(y)) y = new Date().getFullYear();
  var m = parseInt(a[p.indexOf("m")]) - 1;
  var d = parseInt(a[p.indexOf("d")]);
  if(isNaN(d)) d = 1;
  return new Date(y, m, d);
  */
  var y = this.substring(style.indexOf('y'),style.lastIndexOf('y')+1);//年
  var m = this.substring(style.indexOf('M'),style.lastIndexOf('M')+1);//月
  var d = this.substring(style.indexOf('d'),style.lastIndexOf('d')+1);//日
  if(isNaN(y)) y = new Date().getFullYear();
  if(isNaN(m)) m = new Date().getMonth();
  if(isNaN(d)) d = new Date().getDate();
  var dt ;
  eval ("dt = new Date('"+ y+"', '"+(m-1)+"','"+ d +"')");
  return dt;
}

/**//**//**//**
 * 格式化日期
 * @param   d the delimiter
 * @param   p the pattern of your date
 * @author  meizz
 */
Date.prototype.format = function(style) {
  var o = {
    "M+" : this.getMonth() + 1, //month
    "d+" : this.getDate(),      //day
    "h+" : this.getHours(),     //hour
    "m+" : this.getMinutes(),   //minute
    "s+" : this.getSeconds(),   //second
    "w+" : "日一二三四五六".charAt(this.getDay()),   //week
后面还有 463 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。