Javascript在网页中显示倒影时钟特效
1、为了方便举例,我就是用记事本来编辑演示。打开电脑中的记事本程序,首先输入基本的网页标签代码。

2、然后在<head></head>标签之间定义style样式代码。
.time{font-size: 45pt; line-height: 45pt; color: red;}

3、然后,还在head标签之间定义函数,设定网页中显示的倒影区域的位置,如下。
<script language=javascript>
var jishi;
function dy(){
if(document.all){
sj2.style.left=sj1.style.posleft;
sj2.style.top=sj1.style.postopz+sj1.offsetheight-6;
setsj();
}
}

4、定义函数设定时钟显示的内容和刷新频率,代码如下。
function setsj(){
var time=new date();
hours=time.gethours();
mins=time.getminutes();
secs=time.getseconds();
if(hours<10)
hours="0"+hours;
if(mins<10)
mins="0"+mins;
if(secs<10)
secs="0"+secs;
sj1.innerhtml=hours+":"+mins+":"secs
sj2.innerhtml=hours+":"+mins+":"secs
jishi=settimeout('setsj()',960);
}

5、接下来,在body标签中输入代码,让网页加载时显示时钟。
<body onload="dy()">
<div class=time id=sj1 style="height:55px;left:110px;position:absolute;top:75px;width:10px">
</div>

6、然后,输入倒影代码,这里使用IE滤镜flipv和alpha,代码如下。
<div class=time id=sj2 style="FILTER: flipv() alpha(opacity=20); font-style:italic;position:absolute">
</div>

7、将记事本代码保存为.html网页格式后,打开预览效果。
需要注意的是这种特效只可以在IE中显示。
