function displayDate(){ let currentTime = new Date().getTime(); let tomorrowTime = new Date().getTime()+currentTime; if(currentTime < tomorrowTime){ alert("会☻") }else{ alert("不会☹") } }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>菜鸟教程(runoob.com)</title> </head> <body> <button class="lxy" type="button" onclick="displayDate()">今天会准时下班?</button> </body> </html>
.lxy{ height: 50px; background-color: bisque; border-color: bisque; }