JS DatePicker: jscalendar-1.0___v1.51 (JS日期選取器)

來源:互聯網
上載者:User

http://files.cnblogs.com/wucg/jscalendar-1.0___v1.51.zip

JS DatePicker: jscalendar-1.0___v1.51

from:

http://sourceforge.net/projects/jscalendar/

http://files.cnblogs.com/wucg/jscalendar-1.0___v1.51.zip

Quick startup

Installing the calendar used to be quite a task until version 0.9.3. Starting with 0.9.3 I have included the file calendar-setup.js whose goal is to assist you to setup a popup or flat calendar in minutes. You are encouraged to modify this file and not calendar.js if you need extra customization, but you're on your own.

First you have to include the needed scripts and style-sheet. Make sure you do this in your document's <head> section, also make sure you put the correct paths to the scripts.

<style type="text/css">@import url(calendar-win2k-1.css);</style><script type="text/javascript" src="calendar.js"></script><script type="text/javascript" src="lang/calendar-en.js"></script><script type="text/javascript" src="calendar-setup.js"></script>

2.1  Installing a popup calendar

Now suppose you have the following HTML:

<form ...>  <input type="text" id="data" name="data" />  <button id="trigger">...</button></form>

You want the button to popup a calendar widget when clicked? Just insert the following code immediately after the HTML form:

<script type="text/javascript">  Calendar.setup(    {      inputField  : "data",         // ID of the input field      ifFormat    : "%m %d, %Y",    // the date format      button      : "trigger"       // ID of the button    }  );</script>

The Calendar.setup function, defined in calendar-setup.js takes care of ``patching'' the button to display a calendar when clicked. The calendar is by default in single-click mode and linked with the given input field, so that when the end-user selects a date it will update the input field with the date in the given format and close the calendar. If you are a long-term user of the calendar you probably remember that for doing this you needed to write a couple functions and add an ``onclick'' handler for the button by hand.

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.