邯郸市领创中等专业学校,是经河北省教育厅、邯郸市教育局批准成立的全日制中职学校。
领创新闻

网页中逐渐变色的文字特效

时间:2013-05-27 15:27:37 发布:admin 来源:未知

<!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>逐渐变色的字</title>
<style>
.box{
position:relative;
width:1000px;
}
.comm{
font-size:60px;
color:#ddd;
font-family:黑体;
position: absolute;
top:0;
left:0;
}
.red{
color: #0000FF;
width: 0;
overflow: hidden;
white-space: nowrap;
z-index: 10;
};
</style>
</head>
<body>
<div class="box">
<strong id="Title" class="comm"><a class="channel_keylink" href="http://www.wangyeba.com">网页</a>吧www.wangyeba.com</strong>
</div>
<script>
function getStyle( elem, name )
{
if (elem.style[name])
return elem.style[name];
else if (elem.currentStyle)
return elem.currentStyle[name];
else if (document.defaultView && document.defaultView.getComputedStyle) {
name = name.replace(/([A-Z])/g,"-$1");
name = name.toLowerCase();
var s = document.defaultView.getComputedStyle(elem,"");
return s && s.getPropertyValue(name);}
else return null;
}
(function(){
var lb = document.getElementById("Title"),
lt = lb.cloneNode(true),
i = 0,
sw = parseInt(getStyle(lb,'width'));
lt.setAttribute('id',lb.getAttribute('id')+'1');
lt.className = 'comm red';
lb.parentNode.appendChild(lt);
window.sliderFont = setInterval(function(){
parseInt(getStyle(lt,'width')) >= sw ? clearInterval(window.sliderFont) : lt.style['width'] = i++ + 'px';
},10);
})();
</script>
</body>
</html>

关键字:网页 html
 
友情链接

0310-8170888

工作时间(周一到周日:9:00-17:00)

扫一扫 加关注