Edit The Code:
See Result »
Try it Yourself - ©
w3big.com
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>本教程(w3big.com)</title> </head> <body> <input type="time" id="myTime"><br><br> <button onclick="disableBtn()">禁用 Time 字段</button> <button onclick="undisableBtn()">启用 Time 字段</button> <script> function disableBtn() { document.getElementById("myTime").disabled = true; } function undisableBtn() { document.getElementById("myTime").disabled = false; } </script> </body> </html>