Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我尝试了明显的,但不起作用......
var dtel = document.getElementById("element-id"); dtel.value = new Date();
它需要一个字符串,但语法是什么?
经过多次试验和错误,我发现以下工作:
var dtel = document.getElementById("element-id"); var dt = new Date(); dtel.value = dt.toISOString();