Javascript脚本特效示例:[31]倒影时钟

2025-11-01 10:58:16

1、在桌机上新建文本文档,命名为晓博JavaScript特效测试.txt,在文本文档里中入HTML文档的基本元素如下,并保存。

<html>

<head>

<title>晓博JavaScript特效测试</title>

</head>

<body>

</body>

</html>

Javascript脚本特效示例:[31]倒影时钟

Javascript脚本特效示例:[31]倒影时钟

2、第一步:把如下代码加入<head>区域中

<head>

<style>

.time { font-size: 12pt; line-height: 14pt; color:red;}

</style>

<SCRIPT language=JavaScript>

<!-- Hiding

var ctimer;

function init(){

if (document.all){

tim2.style.left=tim1.style.posLeft;

tim2.style.top=tim1.style.posTop+tim1.offsetHeight-6;

settimes();

}

}

function settimes(){

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;

tim1.innerHTML=hours+":"+mins+":"+secs

tim2.innerHTML=hours+":"+mins+":"+secs

ctimer=setTimeout('settimes()',960);

}

// Done hiding -->

</SCRIPT>

3、第二步:把如下代码加入<body>区域中

<DIV class=time id=tim1 

style="HEIGHT: 20px; LEFT: 50px; POSITION: absolute; TOP: 10px; WIDTH: 10px"></DIV>

<DIV class=time id=tim2 

style="FILTER: flipv() alpha(opacity=20); FONT-STYLE: italic; POSITION: absolute"></DIV>

4、第三步:把<body>改为,并重名文档为HTML文件

<body bgcolor="#fef4d9" onload="init()">

5、用IE浏览器打开晓博JavaScript特效测试.html文件,关闭网页,可以看到特酷的倒影时钟特效,如下图

Javascript脚本特效示例:[31]倒影时钟

Javascript脚本特效示例:[31]倒影时钟

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢