写了一段脚本程序,运行时出现错误,大家帮忙看一下!

rulan 2002-08-05 02:23:55
显示各个时段的问侯语,程序如下:
<script language="javascript">
<--
mydate=new date();
myyear=mydate.getyear();
if(myyear<300) myyear=myyear-100+2000;
mymonth=mydate.getmonth()+1;
today=mydate.getdate();
myhour=mydate.gethour();
if (myhour<6)
welcomestring="凌晨好";
else if (myhour<9)
welcomestring="早上好";
else if (myhour<12)
welcomestring="上午好";
else if (myhour<14)
welcomestring="中午好";
else if (myhour<17)
welcomestring="下午好";
else if (myhour<19)
welcomestring="傍晚好";
else if (myhour<22)
welcomestring="晚上好";
else welcomestring="夜里好";
-->
</script>
...全文
43 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
uvvvw 2002-08-05
  • 打赏
  • 举报
回复
当然错了注释是<!--开头,而不是<--
dylanOK 2002-08-05
  • 打赏
  • 举报
回复
显示各个时段的问侯语,程序如下:
<script language="javascript">
<!--
mydate=new Date();
myyear=mydate.getYear();
if(myyear<300) myyear=myyear-100+2000;
mymonth=mydate.getMonth()+1;
today=mydate.getDate();
myhour=mydate.getHours();
if (myhour<6)
welcomestring="凌晨好";
else if (myhour<9)
welcomestring="早上好";
else if (myhour<12)
welcomestring="上午好";
else if (myhour<14)
welcomestring="中午好";
else if (myhour<17)
welcomestring="下午好";
else if (myhour<19)
welcomestring="傍晚好";
else if (myhour<22)
welcomestring="晚上好";
else welcomestring="夜里好";
document.write(welcomestring);
-->
</script>

87,996

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧