本博客没有华丽的布局,只求朴实的js的代码,只为js代码爱好者提供,一周大概会出1-2篇js前沿代码的文章.只是代码,不说技术.
这个时间组件以前发过一次,上次那个很烂,这次有时间了,把这个升级了,性能更好,完美兼容所有浏览器,ie6下拉select档不住的问题
也解决了.总之,差不多也算一个完美的时间组件,
在线demo nothingDemo 突然发现下面的代码里面有个运行代码可以看在线demo,就再最下面
然后贴出源码,只有一点简单的说明
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Page</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<style type="text/css">
*{margin:0;padding:0;}
body, button, input, select, textarea {
font: 12px/1.125 Arial,Helvetica,sans-serif;
}
/*日期控件*/
.pc_caldr{border:1px solid #ccc;background-color:#fff;z-index:10;width:175px;height:auto;position:absolute;color:#000;padding:5px;}
.pc_caldr .selector{height:24px;_padding:2px 0 2px;padding:2px 0 0;}
.pc_caldr .selector .month,.pc_caldr .selector .year{float:left;font-size:12px;width:80px;border:1px solid #CCC;height:19px;}
.pc_caldr .selector .year{width:84px;margin-left:10px;}
.pc_caldr .weeks,.pc_caldr .days{list-style:none;width:100%!important;margin:0;padding:0;}
.pc_caldr .weeks{height:18px;margin-bottom:2px;background:#b6d1f9;color:#fff;font-size:12px;}
.pc_caldr .days{height:auto;font-size:12px;font-family:Arial;}
.pc_caldr .weeks li,.pc_caldr .days li{float:left;height:20px;line-height:20px;text-align:center;width:25px;}
.pc_caldr .days li{background-color:none;}
.pc_caldr .days li a{display:block;text-decoration:none;height:100%;color:#43609c;transition:transform .5s;-moz-transition:-moz-transform .5s;-webkit-transition:-webkit-transform .5s;-o-transition:-o-transform .5s;padding:1px;}
.pc_caldr .days li a:link,.pc_caldr .days li a:visited,.pc_caldr .days li a:hover{text-decoration:none;}
.pc_caldr .days li a strong{font-weight:400;}
.pc_caldr .days li a:hover{background-color:#5d94e6;color:#fff;transform:rotate(180deg) scale(1.5);-moz-transform:rotate(360deg) scale(1.5);-webkit-transform:rotate(360deg) scale(1.5);-o-transform:rotate(360deg) scale(1.5);}
.pc_caldr .weeks li,.pc_caldr .days li,.pc_caldr .days li a{text-align:center;}
/*文本框*/
.tiemin{width:120px;border:1px solid #f00;}
.inline-block {display :inline-block; zoom:1 ; *display: inline; vertical-align:middle ;}
.ie6iframe {background: none repeat scroll 0 0 #FFFFFF;left: -1px;filter:alpha(opacity=0);position: absolute;top: 0;z-index: -1;width:100%;height:150px;}
</style>
</head>
<body>
<div style="height: 200px;">
</div>
<input type="text" class="tiemin" readonly="readonly" />
<div style="height: 200px;">
</div>
<span style="width: 200px;" class="inline-block"></span>
<input type="text" class="tiemin" readonly="readonly" />
<div style="width: 300px; height: 100px; margin-left: 210px;">
<select>
<option>挡住它nothing</option>
</select>
</div>
<script type="text/javascript">
var nothingTime = (function ($) {
var cache = {
obj: null,
calendar: null,
disappear: function () { //隐藏时间块
cache.calendar.css("display", "none");
},
isLeap: function (year) { //闰年
return (year