简单教程
提交运行
代码编辑器:
<h3>以下实例演示了如何访问 Week 字段</h3> <input type="week" id="myWeek" value="2014-W15"> <p>点击按钮获取 week 字段的周和年</p> <button onclick="myFunction()">点我</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myWeek").value; document.getElementById("demo").innerHTML = x; } </script>
运行结果: