爱易网
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 浏览次数:20285 次
欢迎光临爱易网网页脚本特效中心,点击运行按钮演示特效:
以下是程序代码
脚本说明: 把如下代码加入<body>区域中 <script type="text/javascript"> //<![CDATA[ <!-- function scrollerObj(name,initH,initW,heightB,widthB,content,initBg,Bg,speed,initFl){ //**data**// this.name=name; this.initH=initH; this.initW=initW; this.heightB=heightB; this.widthB=widthB; this.content=content; this.initBg=initBg; this.Bg=Bg; this.iniFl=initFl; this.speed=parseInt(speed); this.timer = name + "Timer"; this.elem; //**methods**// this.getElement = getElement; this.createLayer=createLayer; this.scrollLayer = scrollLayer; this.scrollLoop=scrollLoop; //**initiate methods**// this.createLayer(); this.getElement(); this.scrollLayer(); } //**call this method to stop scrolling**// function scrollLoop(s){ this.speed = s; } //**pretty obvious**// function scrollLayer(){ if(parseInt(this.elem.style.top)>(this.elem.offsetHeight*(-1))){ this.elem.style.top = parseInt(this.elem.style.top)-this.speed; //alert(parseInt(this.elem.style.top)+"\n"+this.elem.id); } else {this.elem.style.top = this.initH;} } //**get the specific dom-expression**// function getElement(){ if(document.getElementById){ this.elem = document.getElementById(this.name); } else if (document.all){ this.elem = document.all[name]; } else if (document.layers){ this.elem = document.layers[name]; } } //**pretty obvious - if NS4 - please upgrade to a standard compliant browser**// function createLayer(){ if(document.getElementById || document.all){ document.write('<div id="layer'+this.name+'" style="position:relative;overflow:hidden;float:'+this.initFl+';background-color:#'+this.initBg+';border:1px solid black;width:'+this.initW+'px;height:'+this.initH+'px;" onMouseover="'+this.name+'.scrollLoop(0)" onMouseout="'+this.name+'.scrollLoop('+this.speed+')">'); document.write('<div id="'+this.name+'" style="position:absolute;top:'+this.initH+'px;left:0px;border:0px solid black;width:'+this.widthB+'px;height:'+this.heightB+'px;background-color:#'+this.Bg+'">'); document.write(this.content); document.write('<\/div><\/div>');} else if(document.layers){ document.write('<ilayer name="'+this.name+'" bgcolor="#'+this.Bg+'" width="'+this.widthB+'" height="'+this.heightB+'">'+this.content+'<\/ilayer>'); return; } if(this.scrollLayer){ this.timer = setInterval(this.name+'.scrollLayer()','30'); } } //--> //]]> </script> <style media="screen" type="text/css"> /*<![CDATA[*/ <!-- P{color:#465d5c;margin:3px;} A{color:#e86500} H1{color:#465d5c;font-size:11px;font-weight:normal;font-weight:bold;font-size:11px;font-family:Arial,Helvetica,Geneva,Swiss,SunSans-Regular;margin:3px; padding:0px} H2{color:#465d5c;font-size:11px;font-weight:bold;font-size:11px;font-family:Arial,Helvetica,Geneva,Swiss,SunSans-Regular;margin:3px; padding:0px} .art{font-weight:normal;font-size:11px;font-family:Arial,Helvetica,Geneva,Swiss,SunSans-Regular;width:100%;border-top:1px solid #FFFFFF;border-bottom:1px solid #FF7F00; padding:3px;margin-bottom:10px;text-align: justify;} .state{color:#e86500;margin-left:5px;margin-right:5px;} #art1{background-color:#FFBB00;} #art2{background-color:#FFCC00;} #art3{background-color:#FFDD00;} #art4{background-color:#FFEE00;} #main{background-image: url(img/bg_px_3.gif);background-color: #cc6600;w
上一篇:狡猾的按钮特效
下一篇:样式表控制相应文字
免责声明:
本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
相关资料
更多>
微软史上最大规模裁员,一半诺基亚员工
英特尔IDF峰会启示:释放移动互联的信号
微软觊觎移动互联市场:手机未出渠道先行
让一让,小米4来了,碰见米粉请务必绕道走!
开个房刷个卡全世界都知道个人隐私成公开秘密
联发科享用价钱战 专利难以摆脱高通
诺基亚依托规模效应 猛攻国际市场空白
2018年阿里云双11活动如何参加?1折优惠大攻略
可靠消息称微型针孔偷拍设备拟全面禁止
推荐阅读
更多>
用户喊话当当网:我彻底把你们丢弃了
团购网站存活率仅18.6% 剩余缺乏千家
靠价格战赚取资费套餐利润差,虚拟运营商必死无疑
iPhone 6将于10月17日内地上市:售5288元起
看病也能用支付宝了 马云的又一盘大棋
神州电脑中止IPO面前:再被质疑财务造假
揭秘:阿里巴巴“无人认领”的三成股权都归谁
微软觊觎移动互联市场:手机未出渠道先行
称产品遭诋毁 奇虎再诉百度
高通拼抢国际芯片市场 联发科海外拓展难安心
快递企业征收“份子钱” 成全了谁 苦了谁?
网络音乐非片面收费 高晓松时间表难完成
网易云音乐能否为丁磊拿到移动互联网门票?
苹果售后生态链乱象:供需失衡价钱不一
银河证券王锦炎:金融业如何使用大数据
奇虎360证明了“惟平台化才能生存”是谬论,中国互联网不能少了周鸿祎
墨迹也要做硬件,工具类应用如何“变异”的
马斯克的特斯拉能否保持好势头
挂号网高管团体离任 或因投资人失掉决计
网曝富士康“二连跳” 疑因推静音模式