<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><meta http-equiv="content-type" content="text/html;charset=utf-8"/><html><body><p>點擊這個按鈕,獲得基于時間的問候。</p><button onclick="myFunction()">點擊這里</button><script>function myFunction(){var x="";var time=new Date().getDay();if (time=0)? { x="Good morning"; }else if (time=1)? {? x="Good day";? }else? { x="Good evening";? }alert(x);}</script></body></html>
為什么getday()不能輸出正確的星期
Hakumatsu
2017-05-28 17:09:52