注册
|
登录
|
设为首页
|
加入收藏
首页
新闻动态
软件应用
图形图像
硬件IT
电脑安全
编程开发
精文荟萃
游戏娱乐
焦点人物
教学视频
互联网
专题
您当前的位置:飞翔学院-IT中国 →
编程开发
→
JavaScript
→ 文章内容
文字从天而降(刷新再看)
作者:佚名 来源:不详 发布时间:2008-5-24 10:17:12
<script LANGUAGE="JavaScript" FPTYPE="dynamicanimation"><!-- // If you want to change this script, you must also make the following // changes so that FrontPage will not overwrite your new script. // In the script tag, change type="dynamicanimation" to type="mydynamicanimation" // In the first script statement, change "dynamicanimation" to "mydynamicanimation" // Throughout the HTML content, change dynamicanimation= to mydynamicanimation= // Change function dynAnimation to function mydynAnimation // In the body tag, change to dynamicanimAttr = "dynamicanimation" animateElements = new Array() currentElement = 0 speed = 0 stepsZoom = 8 stepsWord = 8 stepsFly = 12 stepsSpiral = 16 steps = stepsZoom step = 0 outString = "" function dynAnimation() { var ms = navigator.appVersion.indexOf("MSIE") ie4 = (ms>0) && (parseInt(navigator.appVersion.substring(ms+5, ms+6)) >= 4) if(!ie4) { if((navigator.appName == "Netscape") && (parseInt(navigator.appVersion.substring(0, 1)) >= 4)) { for (index=document.layers.length-1; index >= 0; index--) { layer=document.layers[index] if (layer.left==10000) layer.left=0 } } return } for (index=document.all.length-1; index >= document.body.sourceIndex; index--) { el = document.all[index] animation = el.getAttribute(dynamicanimAttr, false) if(null != animation) { if(animation == "dropWord" || animation == "flyTopRightWord" || animation == "flyBottomRightWord") { ih = el.innerHTML outString = "" i1 = 0 iend = ih.length while(true) { i2 = startWord(ih, i1) if(i2 == -1) i2 = iend outWord(ih, i1, i2, false, "") if(i2 == iend) break i1 = i2 i2 = endWord(ih, i1) if(i2 == -1) i2 = iend outWord(ih, i1, i2, true, animation) if(i2 == iend) break i1 = i2 } document.all[index].innerHTML = outString document.all[index].style.posLeft = 0 document.all[index].setAttribute(dynamicanimAttr, null) } if(animation == "zoomIn" || animation == "zoomOut") { ih = el.innerHTML outString = "<SPAN " + dynamicanimAttr + "=\"" + animation + "\" style=\"position: relative; left: 10000;\">" outString += ih outString += "</SPAN>" document.all[index].innerHTML = outString document.all[index].style.posLeft = 0 document.all[index].setAttribute(dynamicanimAttr, null) } } } I = 0 for (index=document.body.sourceIndex; index < document.all.length; index++) { el = document.all[index] animation = el.getAttribute(dynamicanimAttr, false) if (null != animation) { if(animation == "flyLeft") { el.style.posLeft = 10000-offsetLeft(el)-el.offsetWidth el.style.posTop = 0 } else if(animation == "flyRight") { el.style.posLeft = 10000-offsetLeft(el)+document.body.offsetWidth el.style.posTop = 0 } else if(animation == "flyTop" || animation == "dropWord") { el.style.posLeft = 0 el.style.posTop = document.body.scrollTop-offsetTop(el)-el.offsetHeight } else if(animation == "flyBottom") { el.style.posLeft = 0 el.style.posTop = document.body.scrollTop-offsetTop(el)+document.body.offsetHeight } else if(animation == "flyTopLeft") { el.style.posLeft = 10000-offsetLeft(el)-el.offsetWidth el.style.posTop = document.body.scrollTop-offsetTop(el)-el.offsetHeight } else if(animation == "flyTopRight" || animation == "flyTopRightWord") { el.style.posLeft = 10000-offsetLeft(el)+document.body.offsetWidth el.style.posTop = document.body.scrollTop-offsetTop(el)-el.offsetHeight } else if(animation == "flyBottomLeft") { el.style.posLeft = 10000-offsetLeft(el)-el.offsetWidth el.style.posTop = document.body.scrollTop-offsetTop(el)+document.body.offsetHeight } else if(animation == "flyBottomRight" || animation == "flyBottomRightWord") { el.style.posLeft = 10000-offsetLeft(el)+document.body.offsetWidth el.style.posTop = document.body.scrollTop-offsetTop(el)+document.body.offsetHeight } else if(animation == "spiral") { el.style.posLeft = 10000-offsetLeft(el)-el.offsetWidth el.style.posTop = document.body.scrollTop-offsetTop(el)-el.offsetHeight } else if(animation == "zoomIn") { el.style.posLeft = 10000 el.style.posTop = 0 } else if(animation == "zoomOut") { el.style.posLeft = 10000 el.style.posTop = 0 } else { el.style.posLeft = 10000-offsetLeft(el)-el.offsetWidth el.style.posTop = 0 } el.initLeft = el.style.posLeft el.initTop = el.style.posTop animateElements[I++] = el } } window.setTimeout("animate();", speed) } function offsetLeft(el) { x = el.offsetLeft for (e = el.offsetParent; e; e = e.offsetParent) x += e.offsetLeft; return x } function offsetTop(el) { y = el.offsetTop for (e = el.offsetParent; e; e = e.offsetParent) y += e.offsetTop; return y } function startWord(ih, I) { for(tag = false; I < ih.length; I++) { c = ih.charAt(I) if(c == '<') tag = true if(!tag) return I if(c == '>') tag = false } return -1 } function endWord(ih, I) { nonSpace = false space = false while(I < ih.length) { c = ih.charAt(I) if(c != ' ') nonSpace = true if(nonSpace && c == ' ') space = true if(c == '<') return I if(space && c != ' ') return I I++ } return -1 } function outWord(ih, i1, i2, dyn, anim) { if(dyn) outString += "<SPAN " + dynamicanimAttr + "=\"" + anim + "\" style=\"position: relative; left: 10000;\">" outString += ih.substring(i1, i2) if(dyn) outString += "</SPAN>" } function animate() { el = animateElements[currentElement] animation = el.getAttribute(dynamicanimAttr, false) step++ if(animation == "spiral") { steps = stepsSpiral v = step/steps rf = 1.0 - v t = v * 2.0*Math.PI rx = Math.max(Math.abs(el.initLeft), 200) ry = Math.max(Math.abs(el.initTop), 200) el.style.posLeft = Math.ceil(-rf*Math.cos(t)*rx) el.style.posTop = Math.ceil(-rf*Math.sin(t)*ry) } else if(animation == "zoomIn") { steps = stepsZoom el.style.fontSize = Math.ceil(50+50*step/steps) + "%" el.style.posLeft = 0 } else if(animation == "zoomOut") { steps = stepsZoom el.style.fontSize = Math.ceil(100+200*(steps-step)/steps) + "%" el.style.posLeft = 0 } else { steps = stepsFly if(animation == "dropWord" || animation == "flyTopRightWord" || animation == "flyBottomRightWord") steps = stepsWord dl = el.initLeft / steps dt = el.initTop / steps el.style.posLeft = el.style.posLeft - dl el.style.posTop = el.style.posTop - dt } if (step >= steps) { el.style.posLeft = 0 el.style.posTop = 0 currentElement++ step = 0 } if(currentElement < animateElements.length) window.setTimeout("animate();", speed) }//--></script><body ><p dynamicanimation="dropWord"style="position: relative !important; left: 10000 !important">欢 迎 光 临 “ 网 络 隧 道 ” !</p><p dynamicanimation="dropWord"style="position: relative !important; left: 10000 !important">发 现 错 误 请 给 我 留 言 或 发 邮 件</p><p dynamicanimation="dropWord"style="position: relative !important; left: 10000 !important">w w w . N e t t u n . C o m</p>
[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
打印文档
推荐好友
返回顶部
增大字体
减少字体
上一篇文章:
COOL闪文字
下一篇文章:
状态栏拼字
分类推荐
·
状态栏左右移动的文字
·
状态栏单字变化的文字
·
彩色变换的文字
·
状态栏滚动文字特效
·
嵌套marquee,产生特别效果
·
通过改变大小写来形成的状态栏特效
·
方块经过的地方文字由大写变为小写
·
如何将状态栏特效用到标题栏
·
如何使超链接被点击后不出现虚线框
·
渐显的超链接文字(很酷)
·
文字快速依次弹出
·
文字从左依次弹出
热点文章
·
文字从天而降(刷新再看)
精采文章
·
[图文]
低配置电脑也能使Vist...
·
Windows 7:20个甚至更多的优...
·
Windows 7测试版将于明年初发...
·
51.COM称将推新版彩虹软件对...
·
[图文]
23项改进 Windows 7对...
精采文章
·
[图文]
低配置电脑也能使Vist...
·
Windows 7:20个甚至更多的优...
·
Windows 7测试版将于明年初发...
·
51.COM称将推新版彩虹软件对...
·
[图文]
23项改进 Windows 7对...
关于本站
|
工作机会
|
合作网站
|
广告服务
|
市场合作
|
联系我们
|
抽奖活动
版权所有: 武汉威俊科技有限公司 Copyright 2005-2007 www.ITCNW.COM All rights reserved