分时问候

    科技2024-11-13  1

    分时问候

    0-12为上午 12-18为下午 18以后为晚上 图片自找

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <div> <img src="sw.gif" alt=""> </div> <script> var img = document.querySelector('img'); var datetime = new Date(); var hour = datetime.getHours(); if(hour>=0 && hour<12){ img.src="./images/sw.gif"; }else if(hour>=12 && hour<18){ img.src="./images/xw.gif"; }else if(hour>=18){ img.src="./images/ws.gif"; } </script> </body> </html>
    Processed: 0.012, SQL: 8