0
$(document).ready(function(){
 $('#data_nasterii').datepicker($.datepicker.regional['ro']); // romanian language
 $('#data_nasterii').datepicker('option', 'changeMonth', true); // dropdown with month
 $('#data_nasterii').datepicker('option', 'changeYear', true); // dropdown with year
 $('#data_nasterii').datepicker('option', 'yearRange', '1900:2020'); // selectable years
 $('#data_nasterii').datepicker('option', 'dateFormat', 'yy-mm-dd'); // date format(ex: 1981-07-25)

});

...
// creating date field with php

echo "<td><div align=\"left\"><input name=\"data_nasterii\" type=\"text\" id=\"data_nasterii\" value=\"".$row['data_nasterii']."\" size=\"10\" maxlength=\"10\" /></div></td></tr>";

如果我点击“清除表单”字段得到正确的值

先感谢您!

4

1 回答 1

0

设置选项的正确方法不是像你一样一次又一次地重复它们。

$(this).datepicker({
        showButtonPanel: true,
        closeText: 'X',
        dateFormat: 'mm/dd/yy',
        buttonText: 'Select Date',
        showOn: 'button',
        duration: 'fast'
    });

尝试以这种格式进行并查看。也尝试不设置日期对象中的值,并尝试在页面加载后使用 java 脚本进行设置。

于 2010-02-02T19:18:34.340 回答