代码编辑器:
x
1
<input type="week" id="myWeek" value="1995-W35">
2
<p>点击按钮获取 week 字段的年和周</p>
3
<button onclick="myFunction()">点我</button>
4
<p id="demo"></p>
5
<script>
6
function myFunction() {
7
var x = document.getElementById("myWeek").value;
8
document.getElementById("demo").innerHTML = x;
9
}
10
</script>
11