图片横向滚动

<style type="text/css">
    <!--
    #demo {
 background: #FFF;
 overflow:hidden;
 border: none;
 width: 965px;
 height: 160px;
    }
    #demo img {
 
    }
    #indemo {
     float: left;
     width: 800%;
    }
    #demo1 {
     float: left;
    }
    #demo2 {
     float: left;
    }
body {
 margin-left: 0px;
 margin-top: 0px;
 margin-right: 0px;
 margin-bottom: 0px;
}
.move_list_cell{height:160px; float:left; width:180px; text-align:center;}
.move_list_img{}
.move_list_pic{height:122px; border:1px solid #ccc; padding:2px;}
.move_list_title{ font-size:12px; margin-top:5px;}
    -->
    </style>
 
    <div id="demo">
    <div id="indemo" style="margin-top:10px;">
    <div id="demo1">
       <%
   SortSql="Select * From product"
 Set SortRs= Server.CreateObject("ADODB.Recordset")
 SortRs.Open SortSql,Conn,1,1
 
do while not SortRs.EOF %>
 <div class="move_list_cell"><div class="move_list_img"><a href="Customer_Show.asp?ItemID=65" target="_blank"><img src="<%=SortRs("product_pic")%>" class="move_list_pic"/></a></div><div class="move_list_title"><%=SortRs("product_name")%></div></div>
    <%
  SortRs.MoveNext
 Loop

 SortRs.Close
 Set SortRs=Nothing
%>
    </div>
    <div id="demo2"></div>
    </div>
    </div>
    <script>
    <!--
    var speed=30; //数字越大速度越慢
    var tab=document.getElementById("demo");
    var tab1=document.getElementById("demo1");
    var tab2=document.getElementById("demo2");
    tab2.innerHTML=tab1.innerHTML;
    function Marquee(){
    if(tab2.offsetWidth-tab.scrollLeft<=0)
    tab.scrollLeft-=tab1.offsetWidth
    else{
    tab.scrollLeft++;
    }
    }
    var MyMar=setInterval(Marquee,speed);
    tab.onmouseover=function() {clearInterval(MyMar)};
    tab.onmouseout=function() {MyMar=setInterval(Marquee,speed)};
    -->
    </script>

posted @ 2011-05-19 09:55  xgcdd  阅读(213)  评论(0编辑  收藏  举报