<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[沧海一粟]]></title> 
<link>http://www.dzhope.com/index.php</link> 
<description><![CDATA[Web系统架构与服务器运维,php开发]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[沧海一粟]]></copyright>
<item>
<link>http://www.dzhope.com/post/234/</link>
<title><![CDATA[日历弹窗的例子]]></title> 
<author>jed &lt;jed521@163.com&gt;</author>
<category><![CDATA[代码编程]]></category>
<pubDate>Thu, 07 Dec 2006 09:17:54 +0000</pubDate> 
<guid>http://www.dzhope.com/post/234/</guid> 
<description>
<![CDATA[ 
	在编程序的过程中，通常遇到这样的情况，要求用户输入日期，结果，他们输入的不规范，导致程序结果最后出现错误，今天，我从网上，搜了一下，找了相应的代码。效果不错，与大家分享一下。<br/>先看看演示吧：<br/>演示：<a href="http://jed.dzhope.com/yanshi.php" target="_blank">http://jed.dzhope.com/yanshi.php</a><br/>怎么样？不错吧<br/>第一步：<br/>在< head>和< /head>之间加上：<br/><div class="code"><br/><br/>&lt;script language=&quot;JavaScript&quot; src=&quot;Calendar30.js&quot;&gt;&lt;/script&gt;<br/><br/></div><br/><br/>第二步：<br/><div class="code"><br/><br/>&lt;INPUT name=date type=text id=&quot;date&quot; size=30 onfocus=&quot;calendar()&quot;&gt;<br/><br/></div><br/><br/>或者<br/><br/><div class="code"><br/><br/>&lt;INPUT name=notice_jdate type=text id=&quot;notice_jdate&quot; size=30 onfocus=&quot;calendar()&quot;&gt;&lt;input type=button value=日期 onclick=&quot;calendar(document.form1.txt)&quot;&gt;<br/><br/></div><br/><br/>下载Calendar30.js<br/><br/><a href="attachment/1165482890_0.rar">点击这里下载文件</a><br/><br/>如果觉得日历弹窗的样式不好看，还可以定制。<br/><br/>修改Calendar30.js里的<br/><br/><div class="code"><br/><br/>function TWebCalendar() //初始化日历的设置<br/>&#123;<br/> &nbsp; &nbsp;this.regInfo &nbsp; &nbsp;= &quot;关闭的快捷键：&#91;Esc&#93;&quot;;<br/> &nbsp; &nbsp;this.regInfo &nbsp; += &quot;&amp;#13;&amp;#13;&quot;;<br/> &nbsp; &nbsp;this.daysMonth &nbsp;= new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);<br/> &nbsp; &nbsp;this.day &nbsp; &nbsp; &nbsp; &nbsp;= new Array(39); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//定义日历展示用的数组<br/> &nbsp; &nbsp;this.dayObj &nbsp; &nbsp; = new Array(39); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//定义日期展示控件数组<br/> &nbsp; &nbsp;this.dateStyle &nbsp;= null; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //保存格式化后日期数组<br/> &nbsp; &nbsp;this.objExport &nbsp;= null; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //日历回传的显示控件<br/> &nbsp; &nbsp;this.eventSrc &nbsp; = null; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //日历显示的触发控件<br/> &nbsp; &nbsp;this.inputDate &nbsp;= null; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //转化外的输入的日期(d/m/yyyy)<br/> &nbsp; &nbsp;this.thisYear &nbsp; = new Date().getFullYear(); //定义年的变量的初始值<br/> &nbsp; &nbsp;this.thisMonth &nbsp;= new Date().getMonth()+ 1; //定义月的变量的初始值<br/> &nbsp; &nbsp;this.thisDay &nbsp; &nbsp;= new Date().getDate(); &nbsp; &nbsp; //定义日的变量的初始值<br/> &nbsp; &nbsp;this.today &nbsp; &nbsp; &nbsp;= this.thisDay +&quot;/&quot;+ this.thisMonth +&quot;/&quot;+ this.thisYear; &nbsp; //今天(d/m/yyyy)<br/> &nbsp; &nbsp;this.iframe &nbsp; &nbsp; = window.frames(&quot;meizzCalendarIframe&quot;); //日历的 iframe 载体<br/> &nbsp; &nbsp;this.calendar &nbsp; = getObjectById(&quot;meizzCalendarLayer&quot;); &nbsp;//日历的层<br/> &nbsp; &nbsp;this.dateReg &nbsp; &nbsp;= &quot;&quot;; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //日历格式验证的正则式<br/><br/> &nbsp; &nbsp;this.yearFall &nbsp; = 50; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //定义年下拉框的年差值<br/> &nbsp; &nbsp;this.format &nbsp; &nbsp; = &quot;yyyy-mm-dd&quot;; //回传日期的格式<br/> &nbsp; &nbsp;this.timeShow &nbsp; = false; &nbsp; &nbsp; &nbsp; &nbsp;//是否返回时间<br/> &nbsp; &nbsp;this.drag &nbsp; &nbsp; &nbsp; = true; &nbsp; &nbsp; &nbsp; &nbsp; //是否允许拖动<br/> &nbsp; &nbsp;this.darkColor &nbsp;= &quot;#0000D0&quot;; &nbsp; &nbsp;//控件的暗色<br/> &nbsp; &nbsp;this.lightColor = &quot;#FFFFFF&quot;; &nbsp; &nbsp;//控件的亮色<br/> &nbsp; &nbsp;this.btnBgColor = &quot;#FFFFF5&quot;; &nbsp; &nbsp;//控件的按钮背景色<br/> &nbsp; &nbsp;this.wordColor &nbsp;= &quot;#000080&quot;; &nbsp; &nbsp;//控件的文字颜色<br/> &nbsp; &nbsp;this.wordDark &nbsp; = &quot;#DCDCDC&quot;; &nbsp; &nbsp;//控件的暗文字颜色<br/> &nbsp; &nbsp;this.dayBgColor = &quot;#E6E6FA&quot;; &nbsp; &nbsp;//日期数字背景色<br/> &nbsp; &nbsp;this.todayColor = &quot;#FF0000&quot;; &nbsp; &nbsp;//今天在日历上的标示背景色<br/> &nbsp; &nbsp;this.DarkBorder = &quot;#D4D0C8&quot;; &nbsp; &nbsp;//日期显示的立体表达色<br/>&#125; &nbsp; var WebCalendar = new TWebCalendar();<br/><br/></div><br/><br/>演示文件下载：<br/><a href="attachment/yanshi.rar">点击这里下载文件</a><br/><br/>本来，很简单的事情，让我给讲复杂了。有不明白的就留言吧！<br/><br/><br/><br/>Tags - <a href="http://www.dzhope.com/tags/%25E6%2597%25A5%25E5%258E%2586%25E5%25BC%25B9%25E7%25AA%2597/" rel="tag">日历弹窗</a> , <a href="http://www.dzhope.com/tags/js%25E6%2597%25B6%25E9%2597%25B4%25E6%258E%25A7%25E4%25BB%25B6/" rel="tag">js时间控件</a>
]]>
</description>
</item><item>
<link>http://www.dzhope.com/post/234/#blogcomment2708</link>
<title><![CDATA[[评论] 日历弹窗的例子]]></title> 
<author>3 &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Fri, 15 Dec 2006 09:08:26 +0000</pubDate> 
<guid>http://www.dzhope.com/post/234/#blogcomment2708</guid> 
<description>
<![CDATA[ 
	我以前都用起了，这次弄了好久，还是没有反映。
]]>
</description>
</item><item>
<link>http://www.dzhope.com/post/234/#blogcomment2709</link>
<title><![CDATA[[评论] 日历弹窗的例子]]></title> 
<author>jed &lt;jed521@163.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Sun, 17 Dec 2006 02:49:52 +0000</pubDate> 
<guid>http://www.dzhope.com/post/234/#blogcomment2709</guid> 
<description>
<![CDATA[ 
	我把演示页面也提供下载了，你下载下来研究研究吧！
]]>
</description>
</item><item>
<link>http://www.dzhope.com/post/234/#blogcomment2978</link>
<title><![CDATA[[评论] 日历弹窗的例子]]></title> 
<author>jed &lt;jed521@163.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Wed, 12 Mar 2008 09:06:52 +0000</pubDate> 
<guid>http://www.dzhope.com/post/234/#blogcomment2978</guid> 
<description>
<![CDATA[ 
	友情提示：firefox浏览器不支持JS时间控件！
]]>
</description>
</item>
</channel>
</rss>