1  /  1  页   1 跳转 查看:1054

标题: 发些滚动的代码

发些滚动的代码

1、逐条显示的滚动(间歇性滚动)

<table width="250" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="78"><DIV id=icefable1>
<TABLE cellSpacing=0 cellPadding=0 width=246 border=0 cellspcing="0">
  <TBODY>
  <TR>
  <TD align="center">{FS400_推荐滚动}<TD></TR></TBODY></TABLE>
</DIV>
<SCRIPT>
marqueesHeight=60;
stopscroll=false;
with(icefable1){
   style.width=246;
   style.height=marqueesHeight;
   style.overflowX='visible';
   style.overflowY='hidden';
   noWrap=true;
   onmouseover=new Function('stopscroll=true');
   onmouseout=new Function('stopscroll=false');
  }
  preTop=0; currentTop=30; stoptime=0;
  icefable1.innerHTML+=icefable1.innerHTML;
function init_srolltext(){
  icefable1.scrollTop=0;
  setInterval('scrollUp()',20);//滚动速度
}init_srolltext();

function scrollUp(){
  if(stopscroll==true) return;
  currentTop+=1;
  if(currentTop==60)     //滚动距离
  {
   stoptime+=1;
   currentTop-=1;
   if(stoptime==60) //滚动间距
   {
    currentTop=0;
    stoptime=0;   
   }
  }
  else {  
   preTop=icefable1.scrollTop;
   icefable1.scrollTop+=1;
   if(preTop==icefable1.scrollTop){
     icefable1.scrollTop=120;
     icefable1.scrollTop+=1;
   }
  }

}
</SCRIPT></td>
        </tr>
      </table>

2、间歇性滚动js代码间歇性滚动js代码

<DIV id=icefable1>
  <p>放被循环内容</p>
  <p>9999999999</p>
  <p>0000000000  </p>
</DIV>

<DIV id=icefable2 style="Z-INDEX: 1; VISIBILITY: hidden; POSITION: absolute"></DIV>

<SCRIPT>
marqueesHeight=90;
stopscroll=false;
icefable1.scrollTop=0;

with(icefable1){
style.width=0;
style.height=marqueesHeight;
style.overflowX="visible";
style.overflowY="hidden";
noWrap=true;
onmouseover=new Function("stopscroll=true");
onmouseout=new Function("stopscroll=false");
}

preTop=0; currentTop=0; stoptime=0;

function init_srolltext(){
icefable2.innerHTML="";
icefable2.innerHTML+=icefable1.innerHTML;
icefable1.innerHTML=icefable2.innerHTML+icefable2.innerHTML;
setInterval("scrollUp()",50);
}
function scrollUp(){
if(stopscroll==true) return;
currentTop+=1;
if(currentTop==17)
{
  stoptime+=1;
  currentTop-=1;
  if(stoptime==50)
  {
    currentTop=0;
    stoptime=0;
  }
}
else {  
   preTop=icefable1.scrollTop;
   icefable1.scrollTop+=1;
   if(preTop==icefable1.scrollTop){
   icefable1.scrollTop=icefable2.offsetHeight-marqueesHeight;
   icefable1.scrollTop+=1;
   }
}

}
init_srolltext();
</SCRIPT>

3、横向滚动
<div id=demo style=overflow:hidden;height:99;width:727;>
                <div id=demo1>{FS_全站图片}
                </div>
                <div id=demo2></div>
              </div>
                <script>
   var speed=20
   demo2.innerHTML=demo1.innerHTML
   function Marquee3(){
   if(demo2.offsetTop-demo.scrollTop<=0)
   demo.scrollTop-=demo1.offsetHeight 
   else{
   demo.scrollTop++
   }
   }
   var MyMar=setInterval(Marquee3,speed)
   demo.onmouseover=function() {clearInterval(MyMar)}
  demo.onmouseout=function() {MyMar=setInterval(Marquee3,speed)}
          </script>
4、来回滚动
<MARQUEE onmouseover=javascript:this.stop(); style="PADDING-RIGHT: 1px; PADDING-LEFT: 1px; PADDING-BOTTOM: 1px; PADDING-TOP: 1px" onmouseout=javascript:this.start(); scrollAmount=1 scrollDelay=5 behavior=alternate width=532 height=100>{FS_最新图图}</MARQUEE>
其他的同志们补充
本帖被评分 1 次
新野视窗 专业网站设计服务!设计定做QQ:612189 群号:2693538
服务理念:做生意,要讲规矩;做服务,要讲热情;做人,要讲厚道!总之,两个字“信誉”!
引用
 

收下了~
引用
 

都答不到完美的效果,都会有点缺陷
引用
 

谢谢。

俺写的长篇:http://hjsm.tom.com/book.php?book_id=35470
引用
 

第一个代码加入滚动新闻,没有实现逐条滚动而且还多出一行滚动消息出来。我超级郁闷。

俺写的长篇:http://hjsm.tom.com/book.php?book_id=35470
引用
 

<style type="text/css">
A.a02 {text-decoration:underline;color:#0B0096;font-size:14px;line-height:160%}
A.a02.hover {text-decoration:none;color:#ff6600;font-size:14px;line-height:160%}
</style>
<script LANGUAGE='JavaScript'>
var totalRolling = 3;
var strArray=new Array();
strArray[0] = '<a class="a02" href="http://public.anyp.cn/Showvote.aspx?sid=14" target="_blank"><font color=red>参加博易可乐调查,赢取收费模板</font></a>';
strArray[1] = '<a class="a02" href="http://g.anyp.cn/" target="_blank"><font color=blue>自助建群</font>功能已经开通!</a>';
strArray[2] = '<a class="a02" href="http://client.alexa.com/install/AlexaInstaller.exe" target="_blank"><font color=red>下载并安装工具条即可屏蔽弹出窗口广告,加快浏览速度</a></a>';
strArray[3] = '<a class="a02" href="http://wuxia.anyp.cn/game/index.aspx" target="_blank"><font color=red>参加侠客行大赛,与甄子丹、阿朵面对面</a></a>';

showId=Math.floor(Math.random()*totalRolling);
tempStr=strArray[showId];
strArray[showId]=strArray[0];
strArray[0]=tempStr;
</script>
<script>
document.write('<table width=100% border=0 cellspacing=0 cellpadding=0>'
+'<tr><td>'
+'<div id="icefable1" style="width:460;">'
+'<table width=460 border=0 cellspacing=0 cellpadding=0>');

for(i=0;i<strArray.length;i++)
{
        document.write('<tr><td> '+strArray+'</td></tr>');
}
document.write('</table>'
+'</div>'
+'</td></tr>'
+'</table>');

marqueesHeight=23;
stopscroll=false;
icefable1.scrollTop=0;

with(icefable1){
  style.width=0;
  style.height=marqueesHeight;
  style.overflowX="visible";
  style.overflowY="hidden";
  noWrap=true;
  onmouseover=new Function("stopscroll=true");
  onmouseout=new Function("stopscroll=false");
}

preTop=0; currentTop=marqueesHeight; stoptime=0;
icefable1.innerHTML+=icefable1.innerHTML;

function init_srolltext(){
  icefable1.scrollTop=0;
  setInterval("scrollUp()",40);
}init_srolltext();

function scrollUp(){
  if(stopscroll==true) return;
  currentTop+=1;
  if(currentTop==marqueesHeight+1)
  {
          stoptime+=1;
          currentTop-=1;
          if(stoptime==40)
          {
                  currentTop=0;
                  stoptime=0;
          }
  }
  else {         
          preTop=icefable1.scrollTop;
          icefable1.scrollTop+=1;
          if(preTop==icefable1.scrollTop){
            icefable1.scrollTop=marqueesHeight*(totalRolling-1);
            icefable1.scrollTop+=1;
          }
  }

}

</script>
这个是逐条滚动的代码,它实现的是向上滚动。不过不知道怎么和标签结合。有大人给与正解不?
那个arry怎么改?
俺写的长篇:http://hjsm.tom.com/book.php?book_id=35470
引用
 

应该不错!
引用
 

回复:发些滚动的代码

留下脚印
引用
 

回复:发些滚动的代码

  谢谢分享
FoosunCMS操作流程:创建栏目-->添加新闻-->添加样式-->创建标签-->将标签插入模板-->生成首页栏目页完成.
引用
 

回复:发些滚动的代码

我再顶一下
引用
 
1  /  1  页   1 跳转

版权所有 Foosun.NET  NewsCMS.com  NewsIDC.COM  Sitemap

Powered by Discuz!NT 2.0.1115    Copyright © 2001-2008 Comsenz Inc.
Processed in 0 second(s) (Cached).
返顶部