大连网站制作客服
主营业务
  • 网站制作
  • 网站维护
  • 网站推广
  • 域名空间
联系电话
联系人:尹先生
QQ:1050706570
E-mail:biz@noonenet.cn
地址:大连市甘井子区哲林北园29号
·首页 >> 网站技术 >> Asp连续不间断滚动图片[四个方向]

Asp连续不间断滚动图片[四个方向]

  更新时间:2009-7-20 17:51:12    编辑:阿帆

多说无益,直接看代码.

以下是<head>区域代码:
<script type="text/javascript">
// 自动滚动
function boxmove(d1,d2,d3,e,obj){
    var speed=30;
    var demo=document.getElementById(d1); 
    var demo1=document.getElementById(d2); 
    var demo2=document.getElementById(d3);
    demo2.innerHTML=demo1.innerHTML;
    function boxTop(){
            if(demo2.offsetTop-demo.scrollTop<=0){demo.scrollTop-=demo1.offsetHeight}
            else{demo.scrollTop++}
        }
    function boxRight(){
            if(demo.scrollLeft<=0){demo.scrollLeft+=demo2.offsetWidth}
            else{demo.scrollLeft--}
        }
    function boxBottom(){ 
            if(demo1.offsetTop-demo.scrollTop>=0){demo.scrollTop+=demo2.offsetHeight}
            else{demo.scrollTop--}
        }
    function boxLeft(){
            if(demo2.offsetWidth-demo.scrollLeft<=0){demo.scrollLeft-=demo1.offsetWidth}
            else{demo.scrollLeft++}
        }
    if(e==1){
            var MoveTop=setInterval(boxTop,speed);
            demo.onmouseover=function(){clearInterval(MoveTop);}
            demo.onmouseout=function(){MoveTop=setInterval(boxTop,speed)}
        }
    if(e==2){
            var MoveRight=setInterval(boxRight,speed);
            demo.onmouseover=function(){clearInterval(MoveRight)}
            demo.onmouseout=function(){MoveRight=setInterval(boxRight,speed)}
        }
    if(e==3){
            var MoveBottom=setInterval(boxBottom,speed);
            demo.onmouseover=function(){clearInterval(MoveBottom);}
            demo.onmouseout=function(){MoveBottom=setInterval(boxBottom,speed)}
        }
    if(e==4){
            var MoveLeft=setInterval(boxLeft,speed)
            demo.onmouseover=function(){clearInterval(MoveLeft)}
            demo.onmouseout=function(){MoveLeft=setInterval(boxLeft,speed)}
        }
    if(e=="top"){
            MoveTop=setInterval(boxTop,speed)
            obj.onmouseout=function(){clearInterval(MoveTop);}
        }
    if(e=="right"){
            MoveRight=setInterval(boxRight,speed)
            obj.onmouseout=function(){clearInterval(MoveRight);}
        }
    if(e=="bottom"){
            MoveBottom=setInterval(boxBottom,speed)
            obj.onmouseout=function(){clearInterval(MoveBottom);}
        }
    if(e=="left"){
            MoveLeft=setInterval(boxLeft,speed)
            obj.onmouseout=function(){clearInterval(MoveLeft);}
        }
    }    
</script>
<style type="text/css">
div#a,div#b,div#c,div#d { float:left;}
h2 { clear:both; }
div#b,div#d,div#bb { white-space:nowrap; }
</style>

 

以下是<body>区域代码:

<h1>滚动合集</h1>
<hr />

<h2>向上</h2>
<div id="a" style="overflow:hidden;height:100px;width:112px;"> 
<div id="a1"> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" />  
</div> 
<div id="a2"></div>
</div> 
<script type="text/javascript">
boxmove("a","a1","a2",1);
</script>


<h2>向右</h2>
<div id="b" style="overflow:hidden;height:100px;width:112px;"> 
<div id="b1">
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" />
</div> 
<div id="b2"></div>
</div> 
<script type="text/javascript">
boxmove("b","b1","b2",2);
</script>

<h2>向下</h2>
<div id="c" style="overflow:hidden;height:100px;width:112px;"> 
<div id="c1"> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" />
</div> 
<div id="c2"></div>
</div> 
<script type="text/javascript">
boxmove("c","c1","c2",3);
</script>

<h2>向左</h2>
<div id="d" style="overflow:hidden;height:100px;width:112px;"> 
<div id="d1"> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
</div> 
<div id="d2"></div>
</div> 
<script type="text/javascript">
boxmove("d","d1","d2",4);
</script>

<h2>手动滚动 - <strong onmouseover="boxmove('aa','aa1','aa2','top',this);">上</strong> <strong onmouseover="boxmove('aa','aa1','aa2','bottom',this);">下</strong></h2>
<div id="aa" style="overflow:hidden;height:100px;width:112px;"> 
<div id="aa1"> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" />
</div> 
<div id="aa2"></div>
</div> 

<h2>手动滚动 - <strong onmouseover="boxmove('bb','bb1','bb2','left',this);">左</strong> <strong onmouseover="boxmove('bb','bb1','bb2','right',this);">右</strong></h2>
<div id="bb" style="overflow:hidden;height:100px;width:112px;"> 
<div id="bb1"> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
<img src="http://www.noonenet.cn/images/logo.gif" alt="" /> 
</div> 
<div id="bb2"></div>
</div>

大家可以试试看效果,可以手动控制滚动方向,很实用的 ...

 

原载: No.1网络工作室 http://www.noonenet.cn/
版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章原始出处、作者信息和本声明。否则将追究法律责任。


Tags:Asp连续 不间断 横向滚动 纵向滚动 向上滚动 向下滚动 图片
同类文章:
· 防止网页被iframe
· sql语句 - 显示一定范围内的记录
· recordcount=-1
· access与sql进行转换时应注意的问题
· html页面中使用request.querystring
返回新闻列表
top
本站关键字:大连网站制作 - 大连网站建设 - 大连网页制作
CopyRight © 2009-2012 No.1网络工作室 All Rights Reserved  sitemap
地址:大连市甘井子区哲林北园29号 电话:13889684613 E-mail:biz@noonenet.cn QQ:1050706570
logo