分享一款文字定时切换显示特效,js实现几行文字定时切换显示,根据自己的需求来自定义文字及切换时间。
<a href="https://www.wuming.ren">武鸣人</a>,各种信息资源免费发布,分享励志语录经典短句,减肥健身常识,各种js特效代码。网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)<hr> <!--欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。--> <script type="text/javascript" src="https://www.wuming.ren/ad/tc.js"></script> <script type="text/javascript" src="https://www.wuming.ren/ad/a.js"></script> <script language="JavaScript1.2"> var delay=2000 var scrollwidth=210 var scrollheight=75 var message=new Array() var openingtag='<font face="宋体" size=3 color=FF9900>' message[0]='<b>武鸣人一号信息11111</b>' message[1]='<b>武鸣人二号信息22222</b>' message[2]='<b>武鸣人三号信息33333</b>' var closingtag='</font>' var hoffset=-10 </script> <ilayer width=&{ scrollwidth}; height=&{ scrollheight}; name="sslide"> <layer name="sslide2" width=&{ scrollwidth}; height=&{ scrollheight};></layer> </ilayer> <script language="JavaScript1.2"> var inc=1 var ns4=document.layers var ie5ns6=document.getElementById||document.all if (ie5ns6) document.write(openingtag+'<div id="flyin" style="position:relative;width:'+scrollwidth+';height:'+scrollheight+';">'+message[0]+'</div>'+closingtag) function updatemsg(){ crossobj.style.left=-2000 crossobj.style.fontStyle="italic" crossobj.innerHTML=message[inc] crossobj.style.left=crossobj.offsetWidth*(-1)+hoffset start=setInterval("animatein()",50) inc=(inc<message.length-1)? inc+1 : 0 }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) function animatein(){ if (parseInt(crossobj.style.left)<0) crossobj.style.left=parseInt(crossobj.style.left)+20 else{ crossobj.style.left=0 crossobj.style.fontStyle="normal" clearInterval(start) } } function updatemsgns4(){ document.sslide.document.sslide2.document.write(openingtag+message[inc]+closingtag) document.sslide.document.sslide2.document.close() inc=(inc<message.length-1)? inc+1 : 0 }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) function initialize(){ if (ie5ns6){ crossobj=document.getElementById? document.getElementById("flyin") : document.all.flyin setInterval("updatemsg()",delay+1000) } else if (ns4){ document.sslide.document.sslide2.document.write(openingtag+message[0]+closingtag) document.sslide.document.sslide2.document.close() setInterval("updatemsgns4()",delay) } }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) window.onload=initialize </script>
本文来自武鸣人网站,转载请注明出处