为了账号安全,请及时绑定邮箱和手机立即绑定

为什么getday()不能输出正确的星期

为什么getday()不能输出正确的星期

Hakumatsu 2017-05-28 17:09:52
<!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>
查看完整描述

4 回答

?
__innocence

TA贡献313条经验 获得超208个赞

if里面,判断是否相等用== 而不是=,=是赋值

查看完整回答
反对 回复 2017-05-28
  • 4 回答
  • 0 关注
  • 1782 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信