展开全部
<script language="JavaScript">
function greeting()
{
var today = new Date();
var hrs = today.getHours();
document.writeln("<CENTER>");
document.write("<H1>");
if (hrs < 6)
document.write("早晨");
else if (hrs < 12)
document.write("上午");
else if (hrs <= 18)
document.write("下午");
else
document.write("晚上");
document.writeln("好!</H1>");
}
greeting();
</script>
function greeting()
{
var today = new Date();
var hrs = today.getHours();
document.writeln("<CENTER>");
document.write("<H1>");
if (hrs < 6)
document.write("早晨");
else if (hrs < 12)
document.write("上午");
else if (hrs <= 18)
document.write("下午");
else
document.write("晚上");
document.writeln("好!</H1>");
}
greeting();
</script>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询