代码如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<script>
var d =new Date();
var time = d.getHours();
if(time<11){
document.write("早");
}
else if(time<13){
document.write("中");
}
else if(time<17){
document.write("下");
}
else{
document.write("晚");
}
</script>
</body>
</html>
效果不展示
根据当前时间输出早;中;下;晚。