源代碼
點擊運行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>教程</title> </head> <body> <form action="demo-form.asp"> 輸入 1980-01-01 之前的日期: <input type="date" name="bday" max="1979-12-31"><br> 輸入 2000-01-01 之後的日期: <input type="date" name="bday" min="2000-01-02"><br> 數量 (在1和5之間): <input type="number" name="quantity" min="1" max="5"><br> <input type="submit"> </form> <p><strong>注意:</strong> Internet Explorer 9及更早 IE 版本,Firefox 不支持 input 標籤的 max 和 min 屬性。</p> <p><strong>注意:</strong> 在 Internet Explorer 10中 max 和 min 屬性不支持輸入日期和時間,IE 10 不支持這些輸入類型。</p> </body> </html>
運行結果