javascript脚本日历输入控件
meizz(梅花雨)斑竹的javascript脚本日历输入控件(呵呵,我借花献佛了)
----------------------------------------------
调用的代码:
<script language=javascript src=setday.js></script>
<input onfocus="setday(this)">
或者
<script language=javascript src=setday.js></script>
<input name=txt><input type=button value=setday onclick="setday(this,document.all.txt)">
控件的代码:
<!--
//-------------------------------------------------------------------------------
// 这是我做的一个日历 javascript 页面脚本控件,适用于微软的 IE (5.0以上)浏览器
// 主调用函数是 setday(this,[object]),[object]是控件输出的控件名,举两个具体调用的例子:
// 一、<input name=txt><input type=button value=setday onclick="setday(this,document.all.txt)">
// 二、<input onfocus="setday(this)">
// 若有什么不足的地方,或者您有更好的建议,请与我联系:mail: meizz@hzcnc.com
// 本日历的年份限制是(1000 - 9999)
//==================================================== WEB 页面显示部分 =====================================================
document.writeln('<div id=meizzDateLayer style="position: absolute; width: 142; height: 166; z-index: 9998; display: none">');
document.writeln('<span id=tmpSelectYearLayer style="z-index: 9999;position: absolute;top: 2; left: 18;display: none"></span>');
document.writeln('<span id=tmpSelectMonthLayer style="z-index: 9999;position: absolute;top: 2; left: 75;display: none"></span>');
document.writeln('<table border=0 cellspacing=1 cellpadding=0 width=142 height=160 bgcolor=#808080 onselectstart="return false">');
document.writeln(' <tr><td width=142 height=23 bgcolor=#FFFFFF><table border=0 cellspacing=1 cellpadding=0 width=140 height=23>');
document.writeln(' <tr align=center><td width=20 align=center bgcolor=#808080 style="font-size:12px;cursor: hand;color: #FFD700" ');
document.writeln(' onclick="meizzPrevM()" title="向前翻 月" Author=meizz><b Author=meizz><<</b>');
document.writeln(' </td><td width=100 align=center style="font-size:12px;cursor:default" Author=meizz>');
document.writeln(' <span Author=meizz id=meizzYearHead onclick="tmpSelectYearInnerHTML(this.innerText)"></span> 年 <span');
document.writeln(' id=meizzMonthHead Author=meizz onclick="tmpSelectMonthInnerHTML(this.innerText)"></span> 月</td>');
document.writeln(' <td width=20 bgcolor=#808080 align=center style="font-size:12px;cursor: hand;color: #FFD700" ');
document.writeln(' onclick="meizzNextM()" title="往后翻 月" Author=meizz><b Author=meizz>>></b></td></tr>');
document.writeln(' </table></td></tr>');
document.writeln(' <tr><td width=142 height=18 bgcolor=#808080>');
document.writeln('<table border=0 cellspacing=0 cellpadding=0 width=140 height=1 style="cursor:default">');
document.writeln('<tr align=center><td style="font-size:12px;color:#FFFFFF" Author=meizz>日</td>');
document.writeln('<td style="font-size:12px;color:#FFFFFF" Author=meizz>一</td><td style="font-size:12px;color:#FFFFFF" Author=meizz>二</td>');
document.writeln('<td style="font-size:12px;color:#FFFFFF" Author=meizz>三</td><td style="font-size:12px;color:#FFFFFF" Author=meizz>四</td>');
document.writeln('<td style="font-size:12px;color:#FFFFFF" Author=meizz>五</td><td style="font-size:12px;color:#FFFFFF" Author=meizz>六</td></tr>');
document.writeln('</table></td></tr><!-- Author:F.R.Huang(meizz) http://www.meizz.com/ mail: meizz@hzcnc.com 2002-10-8 -->');
document.writeln(' <tr><td width=142 height=120>');
document.writeln(' <table border=0 cellspacing=1 cellpadding=0 width=140 height=120 bgcolor=#FFFFFF>');
var n=0; for (j=0;j<5;j++){ document.writeln (' <tr align=center>'); for (i=0;i<7;i++){
document.writeln('<td width=20 height=20 id=meizzDay'+n+' style="font-size:12px" Author=meizz onclick=meizzDayClick(this.innerText)></td>');n++;}
document.writeln('</tr>');}
document.writeln(' <tr align=center><td width=20 height=20 style="font-size:12px" id=meizzDay35 Author=meizz ');
document.writeln(' onclick=meizzDayClick(this.innerText)></td>');
document.writeln(' <td width=20 height=20 style="font-size:12px" id=meizzDay36 Author=meizz onclick=meizzDayClick(this.innerText)></td>');
document.writeln(' <td colspan=5 align=right Author=meizz><span onclick=closeLayer() style="font-size:12px;cursor: hand"');
document.writeln(' Author=meizz title="作者: F.R.Huang(meizz) MAIL: meizz@hzcnc.com"><u>关闭本控件</u></span> </td></tr>');
document.writeln(' </table></td></tr><tr><td>');
document.writeln(' <table border=0 cellspacing=1 cellpadding=0 width=100% bgcolor=#FFFFFF>');
document.writeln(' <tr><td Author=meizz align=left><input Author=meizz type=button value="< " title="向前翻 年" onclick="meizzPrevY()" ');
document.writeln(' onfocus="this.blur()" style="font-size: 12px; height: 20px"><input Author=meizz title="向前翻 月" type=button ');
document.writeln(' value="<<" onclick="meizzPrevM()" onfocus="this.blur()" style="font-size: 12px; height: 20px"></td><td ');
document.writeln(' Author=meizz align=center><input Author=meizz type=button value=Today onclick="meizzToday()" ');
document.writeln(' onfocus="this.blur()" title="现在的年月" style="font-size: 12px; height: 20px"></td><td ');
document.writeln(' Author=meizz align=right><input Author=meizz type=button value=">>" onclick="meizzNextM()" ');
document.writeln(' onfocus="this.blur()" title="往后翻 月" style="font-size: 12px; height: 20px"><input ');
document.writeln(' Author=meizz type=button value=" >" title="往后翻 年" onclick="meizzNextY()"');
document.writeln(' onfocus="this.blur()" style="font-size: 12px; height: 20px"></td>');
document.writeln('</tr></table></td></tr></table></div>');
版权声明:
作者:Kiyo
链接:https://www.wkiyo.cn/html/2008-01/i100.html
来源:Kiyo's space
文章版权归作者所有,未经允许请勿转载。
共有 0 条评论