javascript 日期控件2

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!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 runat="server">
    <title>无标题页</title>
</head>

<body>
<script type="text/javascript" src="calendar.js"></script>

    <form id="form1" runat="server">
    <div>
    <input name="date" type="text" id="date" οnclick="calendar.show(this);" size="10" maxlength="10" readonly="readonly" />
    </div>
    <div>
      <h1>4、使用说明:</h1>
  <h2>4.1、将 js 文件导入到页面中(可以是 html, jsp, asp, aspx, php)等。</h2>
  <div class="source">&lt;script type=&quot;text/javascript&quot; src=&quot;calendar.js&quot;&gt;&lt;/script&gt;</div>
  <br />
  注意以下点:
  <ul>
    <li>&nbsp;calendar.js 文件内容编写是UTF-8,请一定要将此文件的编码设置为UTF-8</li>
    <li>&nbsp;上面的代码内容<span class="color_red b">一定要放在HTML的&lt;body&gt;&lt;/body&gt;之间</span>,特别是在符合XHTML规范的文档中</li>
    <li>包含此文件后,此页面已经自动实例化了一个日历对象 calendar,现在就可以使用了</li>
  </ul>
  <h2>4.2、一个最简单的例子<br />
  </h2>
  <div class="source">用预定义的 calendar 对象生成日历代码:&lt;input name=&quot;date&quot; type=&quot;text&quot; id=&quot;date&quot; οnclick=<strong>&quot;calendar.show(this);</strong>&quot; size=&quot;10&quot; maxlength=&quot;10&quot; readonly=&quot;readonly&quot; /&gt;<br />
  </div>
  <br />
  <div class="effect">效果:
    <input name="date" type="text" id="Text1" οnclick="calendar.show(this);" size="10" maxlength="10" readonly="readonly" />
  </div>
  <br />
  当然也可以这样:<br />
  <div class="source">new 一个新的日历对象并生成日历代码:&lt;input name=&quot;date&quot; type=&quot;text&quot; id=&quot;date&quot; οnclick=<strong>&quot;new Calendar().show(this);</strong>&quot; size=&quot;10&quot; maxlength=&quot;10&quot; readonly=&quot;readonly &quot;/&gt;<br />
  </div>
  <br />
  <div class="effect">效果:
    <input name="date2" type="text" id="date2" οnclick="new Calendar().show(this);" size="10" maxlength="10" readonly="readonly" />
  </div>
  <br />
  <h2>4.3、指定开始年份和结束年份的日历<br />
  </h2>
  <div class="source"> 指定开始年份和结束年份的日历代码:&lt;input name=&quot;range_date&quot; type=&quot;text&quot; id=&quot;range_date&quot; οnclick=&quot;new Calendar(2000, 2008).show(this);&quot; size=&quot;10&quot; maxlength=&quot;10&quot; readonly=&quot;readonly&quot; /&gt;<br />
  </div>
  <br />
  <div class="effect"> 只能选择 2000 到 2008年间的日期:
    <input name="range_date" type="text" id="range_date" οnclick="new Calendar(2000, 2008).show(this);" size="10" maxlength="10" readonly="readonly" />
  </div>
  <h2>4.4、多语言版本支持(可自由扩充),目前支持的语言:0(zh_cn)|1(en_us)|2(en_en)|3(zh_tw)</h2>
  <div class="source"> 中文日历代码:    &lt;input name=&quot;cn_date&quot; type=&quot;text&quot; id=&quot;cn_date&quot; οnclick=&quot;new Calendar().show(this);&quot; size=&quot;10&quot; maxlength=&quot;10&quot; readonly=&quot;readonly&quot; /&gt;<br />
  </div>
  <br />
  <div class="effect">中文日历效果:
    <input name="cn_date" type="text" id="cn_date" οnclick="new Calendar().show(this);" size="10" maxlength="10" readonly="readonly"/>
  </div>
  <br />
  <div class="source"> 繁体中文日历代码:    &lt;input name=&quot;tw_date&quot; type=&quot;text&quot; id=&quot;tw_date&quot; οnclick=&quot;new Calendar(null, null, 3).show(this);&quot; size=&quot;10&quot; maxlength=&quot;10&quot; readonly=&quot;readonly&quot; /&gt;<br />
  </div>
  <br />
  <div class="effect">繁体中文日历效果:
    <input name="tw_date" type="text" id="tw_date" οnclick="new Calendar(null, null, 3).show(this);" size="10" maxlength="10" readonly="readonly" />
    <br />
  </div>
  <br />
  <div class="source"> 英文日历代码:    &lt;input name=&quot;en_date&quot; type=&quot;text&quot; id=&quot;en_date&quot; οnclick=&quot;new Calendar(null, null, 1).show(this);&quot; size=&quot;10&quot; maxlength=&quot;10&quot; readonly=&quot;readonly&quot; /&gt;<br />
  </div>
  <br />
  <div class="effect">英文日历效果:
    <input name="en_date" type="text" id="en_date" οnclick="new Calendar(null, null, 1).show(this);" size="10" maxlength="10" readonly="readonly" />
  </div>
  <h2>4.5、在一个控件上点击选择,在另外一个控件上显示日期</h2>
  <div class="source"> 代码:<br />
    &lt;input name=&quot;control_date&quot; type=&quot;text&quot; id=&quot;control_date&quot;size=&quot;10&quot; maxlength=&quot;10&quot; readonly=&quot;readonly&quot; /&gt;<br />
    &lt;input type=&quot;button&quot; name=&quot;button&quot; id=&quot;button&quot; value=&quot;选择日期&quot; οnclick=&quot;new Calendar().show(this.form.control_date);&quot; /&gt;<br />
  </div>
  <br />
  <div class="effect">效果:
    <input name="control_date" type="text" id="control_date"size="10" maxlength="10" readonly="readonly" />
    <label>
    <input type="button" name="button" id="button" value="选择日期" οnclick="new Calendar().show(this.form.control_date);" />
    </label>
  </div>
    </div>
    </form>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值