x
 
<!DOCTYPE html>
<html>
<body>
<h1>使用 select() 选择月份字段的内容</h1>
月: <input type="month" id="myMonth" value="2023-06">
<p>单击按钮可选择月份字段的内容。</p>
<button type="button" onclick="myFunction()">试一试</button>
<script>
function myFunction() {
  document.getElementById("myMonth").select();
}
</script>
</body>
</html>