<分区>
我用 js 做了这个:
// time
var date = new Date();
var currentTime = date.getHours() + ':' + date.getMinutes();
document.getElementById('timex').value = currentTime;
此脚本在输入中插入小时和分钟。
有个问题,16:06 时间变成了 16:6。这会导致 html 输入出现问题。同样的事情发生在凌晨 1 点。变成 1:34 而不是 01:34。