显示各个时段的问侯语,程序如下:
<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>