当前位置:K88软件开发文章中心编程语言JavaScriptJS01 → 文章内容

javascript逐渐变色的字

减小字体 增大字体 作者:shaoqi     来源:asp编程网  发布时间:2018-12-30 8:57:52

一个字符串,由多个字符组成,开始的时候是灰色的,慢慢地变成了蓝色的字,感觉像有一个灰色的层挡住蓝色的字,慢慢的层移开。这种效果

以下内容为程序代码 以下内容为程序代码

<
!DOCTYPE html PUBLIC "
-//W3C//DTD XHTML 1.0 Transitional//EN"
"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
>

<
html xmlns="
http://www.w3.org/1999/xhtml"
>

<
head>

<
meta http-equiv="
Content-Type"
content="
text/html
charset=gb2312"
/>

<
title>
javascript逐渐变色的字<
/title>

<
style>

div
{
 
position:absolute

 
width:1000px

}
strong
{
 
font-size:50px

 
color:
#ddd

 
font-family:黑体

 
position:absolute

 
top:0

 
left:0

}
.blue
{
 
color:blue

 
width:0

 
overflow:hidden

 
white-space:nowrap

 
z-index:20

}

<
/style>

<
/head>

<
body>

<
div>

 
<
strong id="
Title"
>
www.aspprogram.cn,专业的asp编程网站<
/strong>

<
/div>

<
script>

var down=document.getElementById("
Title"
),up=down.cloneNode(true),i=0

up.className='blue'

down.parentNode.appendChild(up)

setInterval('up.style.width=i+++"
px"
',10)

<
/script>

<
/body>

<
/html>



javascript逐渐变色的字