jquery ui datepicker..我可以使其静态吗?

发布于 2025-01-04 07:14:28 字数 367 浏览 4 评论 0原文

这是一个简单的问题。

我想创建一个没有任何可选日期的内联日历。我希望通过预设的隐藏输入字段选择日期。我应该使用日期选择器插件吗?这似乎是错误的使用方式,因为我并没有真正做任何选择。

任何人对此都有任何经验。只需要制作一个静态日历。

http://www.kelvinluck.com/assets/jquery/datePicker /v2/demo/inlineDatePicker.html

类似的东西,但没有可选择的日期或月份。

This is a simple question.

I want to create an inline calendar that does not have any selectable dates. I want the date to be selected by a preset hidden input field. Should I use the datepicker plugin. This seems like the wrong thing to use since I am not really doing any picking persay..

anyone have any exp with this. Just need to make a static calendar.

http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/inlineDatePicker.html

something like this but without dates or months selectable.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦旅人picnic 2025-01-11 07:14:28

是的,您可以使用它来制作静态日历(但最好是如果您已经在使用一些 jquery ui 功能,这样就不需要下载额外的 js)。

您可以使用两个选项:

  1. 内联(将显示日期选择器日历)
$('#datepicker').datepicker({inline: true});
  1. 禁用(将禁用日历)

$('#datepicker').datepicker({disabled: true});

完整代码(工作)

<head>
<script type="text/javascript">
$(document).ready(function(){
var staticDate = $("#static_date").val();
$('#datepicker').datepicker({
inline: true,
disabled: true,
defaultDate: staticDate
});
});
</script>
</head>
<body>
<input type="hidden" id="static_date" value="01/01/2012" />
<div id="datepicker"></div>
</body>

您可以看到,日期选择器绑定到 div 而不是文本字段。
正文中的第一行是您可以定义静态日期的地方。请记住也使用在日期选择器中设置的格式。

Yes You can use it to make static calendar (but best if You are already using some jquery ui features so no additional js will be necessary for download).

You can use two options:

  1. inline (will show datepicker calendar in line)
$('#datepicker').datepicker({inline: true});
  1. disable (will disable calendar)

$('#datepicker').datepicker({disabled: true});

Full code (working)

<head>
<script type="text/javascript">
$(document).ready(function(){
var staticDate = $("#static_date").val();
$('#datepicker').datepicker({
inline: true,
disabled: true,
defaultDate: staticDate
});
});
</script>
</head>
<body>
<input type="hidden" id="static_date" value="01/01/2012" />
<div id="datepicker"></div>
</body>

You can see, that datepicker is bounded to div not textfield.
First line in body is place where You can define static date. Remember too use format that is also set in datepicker.

哑剧 2025-01-11 07:14:28

考虑到 jqueryui 的额外下载时间,我建议不要使用 jqueryui 并在页面上静态显示禁用的日期选择器。有更好的 php 库来输出日历,如果日历不是太复杂的话,甚至可以自己打印出来。

Considering the extra downloadtime for jqueryui, I would advice against resorting to use jqueryui and have a disabled datepicker staticly display on a page. There is better php libraries to output calendars, or even just print it out yourself, if the calendar is not too complex.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文