<html>
<head>
<title> else if </title>
</head>
<body>
<script type="text/javascript">
var d = new Date();
var t = d.getHours();
if (t>=6 && t<12)
{
document.write("上午好");
}
else if (t>=12 && t<18)
{
document.write("下午好");
}
else
{
document.write("晚上好");
}
</script>
<p>本例演示 if..else if...else 语句。</p>
</body>
</html>