【发布时间】:2011-12-02 03:22:47
【问题描述】:
我有以下带有 UI Datepicker 的脚本,但我需要将日期作为 URL 中的参数。我似乎无法在 URL 中正确格式化日期。带有日期的输入框是很好,但日期没有显示在我的 URL 字符串中..
我需要将 dateText 变量格式化为“yyyy-mm-dd”
<script type="text/javascript">
jQuery(function() {
jQuery('#datepick').datepicker({ dateFormat: "yy-mm-dd" })({
onSelect: function (dateText, inst) {
window.location.href="reports?date=" + dateText;
}
})
});
</script>
谢谢你..
【问题讨论】:
-
您目前看到了什么?日期未填写或日期格式错误?
-
您遇到什么错误?您提供的 JavaScript 不正确。
标签: javascript jquery user-interface datepicker