2012-06-01 41 views
2

我想知道如何在单击文本框时实现日历? 例如:当我点击一个文本框时,日历会弹出。 我喜欢这个:enter image description here在文本框中单击,显示(弹出)日历?

我点击了文本框,日历显示出来了。

感谢

+0

我会想象你想这样做,完全是客户端,使用JavaScript/JQuery的,而不是不断跳闸轮的服务器,因为会有很多交互。该帖子应该相应标记。还有几个现有的库或开源项目提供了使用javascript/JQuery填充日历的代码。我希望使用其中的一个,而不是从头开始编写自己的。这将是相当多的工作。 – Servy

回答

0

喜欢的东西jQuery UI的可能:

http://jqueryui.com/

+0

这应该是一个评论,而不是一个答案 – Servy

+0

为什么?它回答了这个问题 - 如果需要像这样创建日历下拉列表,这将是我将使用的解决方案。 – Paddy

+0

@ Paddy - OP仍然需要进行一些挖掘和挖掘以获得他/她所需的资源。如果您发布的链接具体。 – 5arx

2

跨浏览器实现与jQuery UI的日期选择器:

jQuery UI Datepicker

<script> 
    $(function() { 
     $("#datepicker").datepicker(); 
    }); 
    </script> 



<div class="demo"> 

<p>Date: <input id="datepicker" type="text"></p> 

</div><!-- End demo --> 



<div style="display: none;" class="demo-description"> 
<p>The datepicker is tied to a standard form input field. Focus on the input (click, or use the tab key) to open an interactive calendar in a small overlay. Choose a date, click elsewhere on the page (blur the input), or hit the Esc key to close. If a date is chosen, feedback is shown as the input's value.</p> 
</div><!-- End demo-description -->