爱易网
IT新闻
IT新闻
爱易资讯
网站搭建
云虚拟主机教程
云服务器教程
Apache教程
IIS教程
Nginx教程
网站策划
站长文章
推广教程
淘宝客教程
网页设计
HTML教程
XHTML教程
CSS教程
HTML5教程
CSS3教程
JavaSript基础
JQuery教程
Node.js教程
前端技术
Ajax教程
Js特效
Xml教程
平面设计
页面UI设计
photoshop教程
程序开发
AI人工智能
Asp教程
Php教程
Asp.Net教程
Net Core教程
C#教程
Java教程
Jsp教程
开发技术
微信小程序教程
Uniapp开发教程
微信公众号开发
Andriod教程
IOS教程
DOS教程
Python教程
Docker教程
Windows Container教程
数据库
MSSQL教程
MySQL教程
Redis教程
Access教程
Oracle教程
数据库教程
操作系统
Linux教程
Windows教程
MAC教程
Cisco教程
交换机教程
防火墙教程
搜索
爱易网页
JS特效
来自动网的打字效果
来自动网的打字效果
日期:2014-05-18 浏览次数:20232 次
以下是HTML网页特效代码,点击运行按钮可查看效果:
以下是程序代码
<SCRIPT language=JAVAscript> // ------ 定义全局变量 var theNewsNum; var theAddNum; var totalNum; var CurrentPosion=0; var theCurrentNews; var theCurrentLength; var theNewsText; var theTargetLink; var theCharacterTimeout; var theNewsTimeout; var theBrowserVersion; var theWidgetOne; var theWidgetTwo; var theSpaceFiller; var theLeadString; var theNewsState; function startTicker(){ // ------ 设置初始数值 theCharacterTimeout = 50;//字符间隔时间 theNewsTimeout = 2000;//新闻间隔时间 theWidgetOne = "_";//新闻前面下标符1 theWidgetTwo = "-";//新闻前面下标符 theNewsState = 1; theNewsNum = document.getElementById("incoming").children.AllNews.children.length;//新闻总条数 theAddNum = document.getElementById("incoming").children.AddNews.children.length;//补充条数 totalNum =theNewsNum+theAddNum; theCurrentNews = 0; theCurrentLength = 0; theLeadString = " "; theSpaceFiller = " "; runTheTicker(); } // --- 基础函数 function runTheTicker(){ if(theNewsState == 1){ if(CurrentPosion<theNewsNum){ setupNextNews(); } else{ setupAddNews(); } CurrentPosion++; if(CurrentPosion>=totalNum||CurrentPosion>=1){ CurrentPosion=0;//最多条数不超过num_gun条 } } if(theCurrentLength != theNewsText.length){ drawNews(); } else{ closeOutNews(); } } // --- 跳转下一条新闻 function setupNextNews(){ theNewsState = 0; theCurrentNews = theCurrentNews % theNewsNum; theNewsText = document.getElementById("AllNews").children[theCurrentNews].children.Summary.innerText; theTargetLink = document.getElementById("AllNews").children[theCurrentNews].children.Summary.children[0].href; theCurrentLength = 0; document.all.hottext.href = theTargetLink; theCurrentNews++; } function setupAddNews() { theNewsState = 0; theCurrentNews = theCurrentNews % theAddNum; theNewsText = document.getElementById("AllNews").children[theCurrentNews].children.Summary.innerText; theTargetLink = document.getElementById("AllNews").children[theCurrentNews].children.Summary.children[0].href; theCurrentLength = 0; document.all.hottext.href = theTargetLink; theCurrentNews++; } // --- 滚动新闻 function drawNews(){ var myWidget; if((theCurrentLength % 2) == 1){ myWidget = theWidgetOne; } else{ myWidget = theWidgetTwo; } document.all.hottext.innerHTML = theLeadString + theNewsText.substring(0,theCurrentLength) + myWidget + theSpaceFiller; theCurrentLength++; setTimeout("runTheTicker()", theCharacterTimeout); } // --- 结束新闻循环 function closeOutNews(){ document.all.hottext.innerHTML = theLeadString + theNewsText + theSpaceFiller; theNewsState = 1; setTimeout("runTheTicker()", theNewsTimeout); } window.onload=startTicker; </SCRIPT> <a href="" id="hottext"></a> <div id=incoming style="DISPLAY: none;float:left"> <div id=AllNews > <div id=0> <div id="Summary" style="border:1px solid red"> <a href="http://p.dvbbs.net/dispbbs-11-0-1-20932-0-0-0" target="_blank"><font><b>众望所归 动网PHP 2.0正式发布</b></font></a> <a href="http://p.dvbbs.net/" target="_blank"><font color="red"><b>动网论坛PHP官方站点</b></font></a> </div> <div id=NewsLink ></div> </div> </div> <div id=AddNews height="25"></div> </div></font> <a href="http://js.aiyiweb.com/">欢迎访问爱易网网页特效代码站,js.aiyiweb.com</a>
上一篇:狡猾的按钮特效
下一篇:marquee的另类用法
免责声明:
本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
相关资料
更多>
苏宁双线同价遇难题:第一个吃螃蟹不轻松
唯品会荣登“最贵中概股”的欢喜与哀愁
去看看外面的世界吧!别窝里斗了,中国在线旅游商们
Line风靡亚洲,在北美却进展缓慢
微软确认 Surface 计划更多尺寸和LTE 版本
打车软件竞争白热化:有冷兵器时代意味
微软史上最大规模裁员,一半诺基亚员工
途牛旅游网今晚挂牌纳斯达克 融资1亿美元
惠普中国转型只是缩影 未来开展不可预期
推荐阅读
更多>
小米2S试水高端化 纯“性价比”玩法已成过去式
传搜狗估值12亿美元 与360谈判进入白热化
盘点改变社会的15种科技:谷歌眼镜将使我们成为半机械人
中移动财报外的"五座大山":运营商沦为走秀陪衬
支付宝钱包支持医保移动缴费 广州成首个试点
传苹果与雅虎协作信息提供 进一步摆脱谷歌
黑莓高管:黑莓能作为家“小众公司”活下来
亚马逊落户上海自贸区:美国货直邮中国
火一把就死: 百度魔图验证社交游戏衰亡宿命
永不磨灭的九大尖端编程语言
360涉足搜索范围 百度市场份额面临应战
携程整合去哪儿陷入僵局 欲联手老对手艺龙
地图导航骤起杀机 百度高德重新定义商业模式
途牛旅游网今晚挂牌纳斯达克 融资1亿美元
第二梯队也PK:当1号店“遇上”京东手机节
清点:罗永浩推锤子ROM 小米打法遭模拟
美国电影协会在华起诉迅雷侵权 要求赔偿并道歉
微软不会被颠覆
任正非:喜马拉雅山的水为什么不能流入亚马逊河?
传诺基亚Lumia928下月推出 将与iPhone5看齐