运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
转到 Spaces
<!DOCTYPE html> <html> <body> Date: <input type="date" id="myDate" name="bday" min="1980-01-01" max="2000-01-01"> <p>Click the button to change the value of the max attribute of the date field.</p> <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() { let x = document.getElementById("myDate").max = "2014-01-01"; document.getElementById("demo").innerHTML = "The value of the max attribute was changed from '2000-01-01' to '2014-01-01'."; } </script> </body> </html>