x
 
<!DOCTYPE html>
<html>
<body>
生日(年月):<input type="month" id="myMonth" name="bdaymonth">
<p>点击按钮可返回月份字段 name 属性的值。</p>
<button onclick="myFunction()">试一试</button>
<p><b>注意:</b>type="month" 的输入元素在 Firefox 中不会显示为任何日期字段/日历。</p>
<p id="demo"></p>
<script>
function myFunction() {
  var x = document.getElementById("myMonth").name;
  document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>