3个回答
2013-07-17
展开全部
<script language="JavaScript">
<!--
var mess1="";var mess2= "欢迎光临!"
document.write("<center><b>")
day = new Date( )
hr = day.getHours( )
if (( hr >= 0 ) && (hr <= 4 ))
mess1="深夜了,注意身体哦... "
if (( hr >= 4 ) && (hr < 7))
mess1="清晨好,起得真早啊... "
if (( hr >= 7 ) && (hr < 12))
mess1="早上好,"
if (( hr >= 12) && (hr <= 13))
mess1="午饭时间喔,"
if (( hr >= 13) && (hr <= 17))
mess1="外面的太阳猛烈吗? "
if (( hr >= 17) && (hr <= 18))
mess1="进入傍晚了,"
if ((hr >= 18) && (hr <= 19))
mess1="我大概在吃晚饭了,"
if ((hr >= 19) && (hr <= 23))
mess1="又到晚上黄金上网时间了,"
document.write(mess1)
document.write(mess2)
document.write("</b></center>")
//--->
</script>
<!--
var mess1="";var mess2= "欢迎光临!"
document.write("<center><b>")
day = new Date( )
hr = day.getHours( )
if (( hr >= 0 ) && (hr <= 4 ))
mess1="深夜了,注意身体哦... "
if (( hr >= 4 ) && (hr < 7))
mess1="清晨好,起得真早啊... "
if (( hr >= 7 ) && (hr < 12))
mess1="早上好,"
if (( hr >= 12) && (hr <= 13))
mess1="午饭时间喔,"
if (( hr >= 13) && (hr <= 17))
mess1="外面的太阳猛烈吗? "
if (( hr >= 17) && (hr <= 18))
mess1="进入傍晚了,"
if ((hr >= 18) && (hr <= 19))
mess1="我大概在吃晚饭了,"
if ((hr >= 19) && (hr <= 23))
mess1="又到晚上黄金上网时间了,"
document.write(mess1)
document.write(mess2)
document.write("</b></center>")
//--->
</script>
展开全部
<script>
function test(){
t = document.getElementById("time").value;
hour = t.split(":")[0];
m = t.split(":")[1];
if(hour>24 || hour<0 || m<0 || m>60 || hour == null || m==null){
document.getElementById("show").innerHTML="输入错误";
}else if(hour >= 18|| hour < 8){
document.getElementById("show").innerHTML="晚上好";
}else if(hour >=8 && hour <12){
document.getElementById("show").innerHTML="上午好";
}else if(hour >=12 && hour <13){
document.getElementById("show").innerHTML="中午好";
}else if(hour >=13 && hour <18){
document.getElementById("show").innerHTML="下午好";
}
}
</script>
<br>
<input type="text" id="time" onchange="test();"/>
<br/>
<span id="show"/>
function test(){
t = document.getElementById("time").value;
hour = t.split(":")[0];
m = t.split(":")[1];
if(hour>24 || hour<0 || m<0 || m>60 || hour == null || m==null){
document.getElementById("show").innerHTML="输入错误";
}else if(hour >= 18|| hour < 8){
document.getElementById("show").innerHTML="晚上好";
}else if(hour >=8 && hour <12){
document.getElementById("show").innerHTML="上午好";
}else if(hour >=12 && hour <13){
document.getElementById("show").innerHTML="中午好";
}else if(hour >=13 && hour <18){
document.getElementById("show").innerHTML="下午好";
}
}
</script>
<br>
<input type="text" id="time" onchange="test();"/>
<br/>
<span id="show"/>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-07-17
展开全部
<script>
today=new Date();
var day;
var date;
var hello;
hour=today.getHours()
if(hour < 6)hello='凌晨好! '
else if(hour < 9)hello='早上好! '
else if(hour < 12)hello='上午好! '
else if(hour < 13)hello='中午好! '
else if(hour < 17)hello='下午好! '
else if(hour < 19)hello='傍晚好! '
else if(hour < 22)hello='晚上好! '
else {hello='午好! '}
day=today.getDay()
if(day==0)day=' 星期日'
else if(day==1)day=' 星期一'
else if(day==2)day=' 星期二'
else if(day==3)day=' 星期三'
else if(day==4)day=' 星期四'
else if(day==5)day=' 星期五'
else if(day==6)day=' 星期六'
date=(today.getYear())+'年'+(today.getMonth()+1)+'月'+today.getDate()+'日';
document.write("<strong><font color=#ff6600>" +hello+"</font></strong>");
document.write('今天是 ')
document.write(date);
document.write(day);
</script>
today=new Date();
var day;
var date;
var hello;
hour=today.getHours()
if(hour < 6)hello='凌晨好! '
else if(hour < 9)hello='早上好! '
else if(hour < 12)hello='上午好! '
else if(hour < 13)hello='中午好! '
else if(hour < 17)hello='下午好! '
else if(hour < 19)hello='傍晚好! '
else if(hour < 22)hello='晚上好! '
else {hello='午好! '}
day=today.getDay()
if(day==0)day=' 星期日'
else if(day==1)day=' 星期一'
else if(day==2)day=' 星期二'
else if(day==3)day=' 星期三'
else if(day==4)day=' 星期四'
else if(day==5)day=' 星期五'
else if(day==6)day=' 星期六'
date=(today.getYear())+'年'+(today.getMonth()+1)+'月'+today.getDate()+'日';
document.write("<strong><font color=#ff6600>" +hello+"</font></strong>");
document.write('今天是 ')
document.write(date);
document.write(day);
</script>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询