//全局变量 var format = ""; //构造符合datetime-local格式的当前日期 function getFormat(){ format = ""; var nTime = new Date(); format += nTime.getFullYear()+"-"; format += (nTime.getMonth()+1)<10?"0"+(nTime.getMonth()+1):(nTime.
需求:想设置Imput标签Date默认值为当前时间,通过JavaScript实现. <html> ...... <body> <input type="date" id="date_info" placeholder="请输入时间"/> ...... <script> $(document).ready(function () { var time = new Date(); var day = (