x
 
<!DOCTYPE html>
<html>
<body>
<h1>使用 select() 选择日期时间字段的内容</h1>
日期时间文本字段:<input type="datetime" id="myDatetime" value="2023-02-15T08:30Z">
<p>单击按钮以选择日期时间字段的内容。</p>
<button type="button" onclick="myFunction()">试一试</button>
<script>
function myFunction() {
  document.getElementById("myDatetime").select();
}
</script>
</body>
</html>