我嘗試運(yùn)行我的代碼,但是它不起作用我已經(jīng)嘗試使用“顏色”變量,使用rgb(x,x,x)代碼,#xxxx,不帶引號...var thehours = new Date().getHours();if (thehours >= 0 && thehours < 12) { document.body.style.backgroundColor = "white";} else if (thehours >= 12 && thehours < 18) { document.body.style.backgroundColor = "grey";} else if (thehours >= 18 && thehours < 24) { document.body.style.backgroundColor = "black"; }在控制臺中,我收到此消息:“ Uncaught TypeError:在design.js:3處無法讀取null的'style'屬性”
我嘗試使用當(dāng)前時(shí)間更改背景的顏色
回首憶惘然
2021-05-19 17:18:15