当前位置:编程学习 > C#/ASP.NET >>

各位 高手~!!看看为什么滚动不起来~~

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>精彩推荐</title>
<style type="text/css">
    <!--

.sinTip {font-size:14px;
        height: 402px;
    }

#ullist1 {height:384px; 
overflow:hidden;line-height:30px;margin:0;padding:0;
        width: 1148px; 
float:left
    }
#ullist1 a{padding-left:15px;}
#ullist1 a, #ullist1 a:link, #ullist1 a:visited {color:#000;text-decoration: none;}
#ullist1 a:hover {color:#c00;}
-->
</style>
</head>
<body>
<div class="sinTip">

<ul id="ullist1">
        <li style="float:left; width:104px; height:212px">
           <table width="104" height="144" border="0" cellspacing="0" cellpadding="0">
               
                <tr>
                  <td height="4"><img src="images/book_1.gif" width="104" height="4" /></td>
                </tr>
                <tr>
                  <td height="120">
                  <table width="104" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="5"><img src="images/book_2.gif" width="5" height="120" /></td>
                      <td width="90">ddddd</td>
                      <td width="9"><img src="images/book_3.gif" width="9" height="120" /></td>
                    </tr>
                  </table>
                  </td>
                </tr>
               
                <tr>
                  <td height="10"><img src="images/book_4.gif" width="104" height="10" /></td>
                </tr>
                <tr>
                  <td align="center">sssss</td>
                </tr>
              </table></li>
               <li style="float:left; width:104px; height:212px">
           <table width="104" height="144" border="0" cellspacing="0" cellpadding="0">
               
                <tr>
                  <td height="4"><img src="images/book_1.gif" width="104" height="4" /></td>
                </tr>
                <tr>
                  <td height="120">
                  <table width="104" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="5"><img src="images/book_2.gif" width="5" height="120" /></td>
                      <td width="90">ddddd</td>
                      <td width="9"><img src="images/book_3.gif" width="9" height="120" /></td>
                    </tr>
                  </table>
                  </td>
                </tr>
               
                <tr>
                  <td height="10"><img src="images/book_4.gif" width="104" height="10" /></td>
                </tr>
                <tr>
                  <td align="center">sssss</td>
                </tr>
              </table></li>
               <li style="float:left; width:104px; height:212px">
           <table width="104" border="0" cellspacing="0" cellpadding="0" style="height: 202px">
               
                <tr>
                  <td height="4"><img src="images/book_1.gif" width="104" height="4" /></td>
                </tr>
                <tr>
                  <td height="120">
                  <table width="104" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="5"><img src="images/book_2.gif" width="5" height="120" /></td>
                      <td width="90">ddddd</td>
                      <td width="9"><img src="images/book_3.gif" width="9" height="120" /></td>
                    </tr>
                  </table>
                  </td>
                </tr>
               
                <tr>
                  <td height="10"><img src="images/book_4.gif" width="104" height="10" /></td>
                </tr>
                <tr>
                  <td align="center">sssss</td>
                </tr>
              </table></li>
               <li style="float:left; width:104px; height:212px">
           <table width="104" height="144" border="0" cellspacing="0" cellpadding="0">
               
                <tr>
                  <td height="4"><img src="images/book_1.gif" width="104" height="4" /></td>
                </tr>
                <tr>
                  <td height="120">
                  <table border="0" cellspacing="0" cellpadding="0" style="width: 104px">
                    <tr>
                      <td width="5"><img src="images/book_2.gif" width="5" height="120" /></td>
                      <td width="90">ddddd</td>
                      <td width="9"><img src="images/book_3.gif" width="9" height="120" /></td>
                    </tr>
                  </table>
                  </td>
                </tr>
               
                <tr>
                  <td height="10"><img src="images/book_4.gif" width="104" height="10" /></td>
                </tr>
                <tr>
                  <td align="center">sssss</td>
                </tr>
              </table></li>

   
      

</ul>
</div>
<script type="text/javascript">
       (function(ul, delay, speed, width) {
              var slideBox = (typeof ul == 'string')?document.getElementById(ul):ul;
              var delay = delay||10;
              var speed=speed||20;
              var lineHeight = width||10;
              var tid = null, pause = false;
              var start = function() {
                     tid=setInterval(slide, speed);
              }
              var slide = function() {
                     if (pause) return;
                     slideBox.scrollRight += 2;
                     if ( slideBox.scrollRight % lineHeight == 0 ) {
                            clearInterval(tid);
                            slideBox.appendChild(slideBox.getElementsByTagName('li')[0]);
                            slideBox.scrollLeft = 0;
                            setTimeout(start, delay);
                     }
              }
              slideBox.onmouseover=function(){pause=true;}
              slideBox.onmouseout=function(){pause=false;}
              setTimeout(start, delay);
       })
       ( 'ullist1', 300, 1, 1000);//停留时间,相对速度(越小越快),每次滚动多少,最好和Li的Line-height一致。
</script>      
</body>

</html> --------------------编程问答-------------------- 小弟要的是从从右至左的一张一张滚动 --------------------编程问答--------------------   slideBox.scrollRight += 2;
  if ( slideBox.scrollRight % lineHeight == 0 ) {
=======================
这两句的问题,仔细改改 --------------------编程问答-------------------- <!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-Type" content="text/html; charset=gb2312" />
<title>精彩推荐</title>
<style type="text/css">
    <!--

.sinTip {font-size:14px;
        height: 210px;
    }

#ullist1 {float:left;height:280px; 
overflow:hidden;margin:0;padding:0; 
        width: 800px;
    }
#ullist1 a{padding-left:15px;}
#ullist1 a, #ullist1 a:link, #ullist1 a:visited {color:#000;text-decoration: none;}
#ullist1 a:hover {color:#c00;}
-->
</style>
</head>
<body>
<div class="sinTip">

<ul id="ullist1">
        <li style="float:left; width:128px; height:210px" ><table width="104" height="144" border="0" cellspacing="0" cellpadding="0">
               
                <tr>
                  <td height="4"><img src="images/book_1.gif" width="104" height="4" /></td>
                </tr>
                <tr>
                  <td height="120">
                  <table width="104" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="5"><img src="images/book_2.gif" width="5" height="120" /></td>
                      <td width="90">aa</td>
                      <td width="9"><img src="images/book_3.gif" width="9" height="120" /></td>
                    </tr>
                  </table>
                  </td>
                </tr>
               
                <tr>
                  <td height="10"><img src="images/book_4.gif" width="104" height="10" /></td>
                </tr>
                <tr>
                  <td align="center">sssss</td>
                </tr>
              </table></li>

      <li style="float:left; width:128px;height:210px"><table width="104" height="144" border="0" cellspacing="0" cellpadding="0">
               
                <tr>
                  <td height="4"><img src="images/book_1.gif" width="104" height="4" /></td>
                </tr>
                <tr>
                  <td height="120">
                  <table width="104" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="5"><img src="images/book_2.gif" width="5" height="120" /></td>
                      <td width="90">bb</td>
                      <td width="9"><img src="images/book_3.gif" width="9" height="120" /></td>
                    </tr>
                  </table>
                  </td>
                </tr>
               
                <tr>
                  <td height="10"><img src="images/book_4.gif" width="104" height="10" /></td>
                </tr>
                <tr>
                  <td align="center">sssss</td>
                </tr>
              </table></li>
      <li style="float:left; width:128px;height:210px"><table width="104" height="144" border="0" cellspacing="0" cellpadding="0">
               
                <tr>
                  <td height="4"><img src="images/book_1.gif" width="104" height="4" /></td>
                </tr>
                <tr>
                  <td height="120">
                  <table width="104" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="5"><img src="images/book_2.gif" width="5" height="120" /></td>
                      <td width="90">cc</td>
                      <td width="9"><img src="images/book_3.gif" width="9" height="120" /></td>
                    </tr>
                  </table>
                  </td>
                </tr>
               
                <tr>
                  <td height="10"><img src="images/book_4.gif" width="104" height="10" /></td>
                </tr>
                <tr>
                  <td align="center">sssss</td>
                </tr>
              </table></li>
      <li style="float:left; width:128px;height:210px"><table width="104" height="144" border="0" cellspacing="0" cellpadding="0">
               
                <tr>
                  <td height="4"><img src="images/book_1.gif" width="104" height="4" /></td>
                </tr>
                <tr>
                  <td height="120">
                  <table width="104" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="5"><img src="images/book_2.gif" width="5" height="120" /></td>
                      <td width="90">dd</td>
                      <td width="9"><img src="images/book_3.gif" width="9" height="120" /></td>
                    </tr>
                  </table>
                  </td>
                </tr>
               
                <tr>
                  <td height="10"><img src="images/book_4.gif" width="104" height="10" /></td>
                </tr>
                <tr>
                  <td align="center">sssss</td>
                </tr>
              </table></li>
<!--  <li style="float:left; width:104px">
              </li>-->

      

</ul>
</div>
<script type="text/javascript">
       (function(ul, delay, speed, lineHeight) {
              var slideBox = (typeof ul == 'string')?document.getElementById(ul):ul;
              var delay = delay||300;
              var speed=speed||20;
              var lineHeight = lineHeight||128
              var tid = null, pause = false;
              var start = function() {
                     tid=setInterval(slide, speed);
              }
              var slide = function() {
                     if (pause) return;
                     slideBox.scrollLLeft += 2;
                     if ( slideBox.scrollLeft % lineHeight == 0 ) {
                            clearInterval(tid);
                            slideBox.appendChild(slideBox.getElementsByTagName('li')[0]);
                            slideBox.scrollLeft = 0;
                            setTimeout(start, delay);
                     }
              }
              slideBox.onmouseover=function(){pause=true;}
              slideBox.onmouseout=function(){pause=false;}
              setTimeout(start, delay);
       })
       ( 'ullist1', 3000, 1, 128 );//停留时间,相对速度(越小越快),每次滚动多少,最好和Li的Line-height一致。
</script>      
</body>

</html>
当中的字母会滚动,但是上下左右的相框不会滚压,在线等~~ --------------------编程问答-------------------- 学习了。~! --------------------编程问答-------------------- if ( slideBox.scrollRight % lineHeight ==0 ) {


=》》》》》》


if ( slideBox.scrollRight % lineHeight != 0 ) { --------------------编程问答-------------------- 代码太多
http://topic.csdn.net/u/20100301/16/7fec1fe1-aac0-4e85-8a6f-165724bcb3d9.html
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,