站长论坛

标题: PHP动态时钟源源代码 [打印本页]

作者: tznktg    时间: 2007-9-6 11:05
标题: PHP动态时钟源源代码
<html>
<meta name="GENERATOR" Content="Microsoft Visual Studio 6.0">
<head><title>动态数字时钟</title>
<script language="javascript">
<!--
var clockbgcolor='INFOBACKGROUD'; //背景颜色
var clockfgcolor='INFOTEXT'; //文字颜色
var clockborder=0; //边框宽度(为0表示不要边框 )
function clocktick()
{
        now=new Date();
        year=now.getYear();
        month=now.getMonth()+1;
        day=now.getDate();

        hours=now.getHours();
        minutes=now.getMinutes();
        seconds=now.getSeconds();

        //如果时间为一位数,则在前面补0
        if(eval(hours)<10)
        {
                hours="0"+hours;
        }
        if(eval(minutes)<10)
        {
                minutes="0"+minutes;
        }
        if(eval(seconds)<10)
        {
                seconds="0"+seconds;
        }

        now='<font color=red>'+year+'</font>年<font color=red>'+month+'</font>月<font color=red>'+day+'</font>日'+' <font color=red>'+hours+'</font>:<font color=red>'+minutes+'</font>:<font color=red>'+seconds+'</font>';
        //now=now+'<br>'+hours+':'+minutes+':'+seconds;
        if(clockborder!=0)

        now='<table border='+clockborder+'width=100% height=100%><tr><td style="text-align:center; color:'+clockfgcolor+'">'+now+'</td></tr</table>'
        clockdiv.innerHTML = now; //写入页面
        
}
        //这里写入所显示需要的层
        document.writeln('<div id=clockdiv style="text-align:center; width:120; height:50; color:'+clockfgcolor+'; backgroud-color:'+clockbgcolor+'"></div>')
        //设定自动刷新显示的计时器
        setInterval("clocktick()",1000);
        
        -->
        </script>
</head>
<body>
</body>
</html>





欢迎光临 站长论坛 (http://www.tzlink.com/bbs/) Powered by Discuz! X3.2