添加如下代码,其中startTime为<input >中id值
<script>//得到当前日期 formatterDate = function(date) { var day = date.getDate() > 9 ? date.getDate() : "0" + date.getDate(); var month = (date.getMonth() + 1) > 9 ? (date.getMonth() + 1) : "0" + (date.getMonth() + 1); return date.getFullYear() + ‘-‘ + month + ‘-‘ + day; }; window.onload = function () { $(‘#startTime‘).datebox(‘setValue‘, formatterDate(new Date())); } </script>
时间: 2024-11-09 19:14:59