站 内 搜 索
推 荐 合 作 商
优 秀 内 容 推 荐
您当前位置:
中国素材首页
>>
网页特效
>>
状态栏
>> 时间、时段
时间、时段
中国素材网 www.sucai.com 2006-4-23 12:15:00 流量数:
请根据需要修改相关参数
[
查看演示
] 源码如下
----------------------------------------------------------------------------------------
<script language="JavaScript">
<!-- Begin
timeID = null;
timeRunning = false;
function stop () {
if(timeRunning)
clearTimeout(timeID);
timeRunning = false;
}
function time () {
tick = new Date();
hours = tick.getHours();
minutes = tick.getMinutes();
seconds = tick.getSeconds();
day = tick.getDay();
month = tick.getMonth();
date = tick.getDate();
year = tick.getYear();
if(day==0){var weekday = " 星期日"}
if(day==1){var weekday = " 星期一"}
if(day==2){var weekday = " 星期二"}
if(day==3){var weekday = " 星期三"}
if(day==4){var weekday = " 星期四"}
if(day==5){var weekday = " 星期五"}
if(day==6){var weekday = " 星期六"}
if (hours>12){var cbap = "下午"} else { var cbap = "上午"};
current = weekday+","+cbap+" "+ ((hours >12) ? hours -12 :hours)
current += ((minutes < 10) ? ":0" : ":") + minutes
current += ((seconds < 10) ? ":0" : ":") + seconds
window.status=current;
timeID = setTimeout("time()",1000);
timeRunning = true;
}
function run(){
stop();
time();
}
run();
timerONE=window.setTimeout
// End -->
</script>