首页 | 风讯安装 | 后台管理 | 升级转换 | 模板制作 | 标签说明 | 采集说明 | 常见问题 | 自由标签 | 样式管理 | 功能扩展 | 插件使用 |
常 见 问 题
新 手 入 门
中 级 进 阶
高 级 技 巧
 发些滚动的代码 ★★★★★ 【字体:小 大】 
发些滚动的代码
http://www.foosun.cn   作者:四季逗   来源:本站原创  点击:  更新时间:06-11-11 09:58:36
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>
9 7 3 1 2 4 8 :
文章录入:风讯科技  责任编辑:风讯科技  
·上一篇:标题下的分隔线在4.0中如何设置,还有标题的行间距
·下一篇:添加文字广告的解决方案!
【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
 网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
 没有任何评论
2002-2006 Foosun Inc. 四川风讯科技发展有限公司.版权所有  蜀ICP备 05005237