日期:2014-05-16  浏览次数:20322 次

做了一个简易的焦点图!求批...
JScript code

<html>
<head>
<style type="text/css">
#top{width:900px;overflow:hidden;}
#con{height:340px;width:900px;width:2700px;}
#con div.demo{width:900px;height:340px;background:#ff99ff;float:left;}
</style>
</head>
<body>
  <div id="top">
    <div id="con" style="margin-left:0;">
      <div class="demo" style="width:900px;"><p>testetestststs</p></div>
      <div class="demo" style="width:900px;"><p>setestsetsetsetest</p></div>
      <div class="demo" style="width:900px;"><p>testsettsetsetsets</p></div>
    </div>
  </div>
  <script type="text/javascript">
  var $=function(ID){return document.getElementById(ID);}
  var speed=25;
  function scroll(){
    if(Math.abs(parseInt($("con").style.marginLeft))>=parseInt($("con").childNodes[0].style.width)){
      $("con").appendChild($("con").childNodes[0]);
      $("con").style.marginLeft="0px";
      clearTimeout(time);
      setTimeout(function(){time=setTimeout(scroll,speed);},2000);
    } else {
      $("con").style.marginLeft=(parseInt($("con").style.marginLeft)-40)+"px";
      time=setTimeout(scroll,speed);
    }
  }
  var time=setTimeout(scroll,speed);
  </script>  
</body>
</html>



貌似在chrome中无法运行~
求解..

------解决方案--------------------
ie9 chrome ff 下都没看见效果?
------解决方案--------------------
探讨

JScript code

var $=function(ID){return document.getElementById(ID);}
var speed=25;
function scroll(){
if(Math.abs(parseInt($("con").style.marginLeft))>=parseInt($("con").getElementsByTagN……

------解决方案--------------------
问题解决了
------解决方案--------------------
探讨

引用:
问题解决了

没有啊,我想让你们帮我指点一下,哪些地方可以优化的~做的更好的...

------解决方案--------------------
在把手动选择图片页码的功能加上吧
------解决方案--------------------
挺不错的
------解决方案--------------------
不错不错