x
 
<!DOCTYPE html>
<html>
<body>
<h1>演示如何访问 Week field</h1>
<input type="week" id="myWeek" value="2023-W03">
<p>单击该按钮可获取 week 字段的 week 和 year。</p>
<button onclick="myFunction()">试一试</button>
<p><b>注释:</b>IE11、Firefox 或 Safari 不支持 type="week" 的 input 元素。</p>
<p id="demo"></p>
<script>
function myFunction() {
  var x = document.getElementById("myWeek").value;
  document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>