x
 
<!DOCTYPE html>
<html>
<body>
Year and 星期:<input type="week" id="myWeek" name="year_week">
<p>点击按钮可返回星期字段的 name 属性的值。</p>
<button onclick="myFunction()">试一试</button>
<p><b>注意:</b>Internet Explorer 或 Firefox 不支持带有 type="week" 的输入元素。</p>
<p id="demo"></p>
<script>
function myFunction() {
  var x = document.getElementById("myWeek").name;
  document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>