<!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=utf-8" />
<title>无标题文档</title>
</head><body>
<script type="text/javascript">
var obj_marquee;
var marquee_spd = 4000;
var step_c = 0;
function marquee_init() {
  obj_marquee = document.getElementById("marquee");
  var obj_unit = document.getElementById("first");
  var n = Math.ceil(parseInt(obj_marquee.style.height) / obj_unit.offsetHeight);
  for(var i=0; i<n; i++) obj_marquee.appendChild(obj_unit.cloneNode(true));
setInterval("step_c=0;setTimeout('marquee_show()',50)", marquee_spd);
  return;
}
function marquee_show() {
  var marquee_high = parseInt(obj_marquee.style.height);
  var step = marquee_high/12;
  if(obj_marquee.scrollTop >= obj_marquee.childNodes[1].offsetTop) {
    obj_marquee.scrollTop = 0;
    marquee_show();
    return;
  }
  obj_marquee.scrollTop += step;
  if(step_c++ < 12) setTimeout("marquee_show()", 50);
  return;
}
window.onload=marquee_init;
</script>        <div id="marquee" style="overflow: hidden; padding: 0; height: 346px; width: 210px; border: 0px; padding: 0px;">
            <div style="border: 0px; padding: 0px" id="first">
                <!-- Marquee Body Head -->
                <div style="height: 173px; border: 0px; overflow: hidden;">
                    <a href="#" target="_blank">
                        <img src="images/01.jpg" alt="" style="width:210px;height:170px;border:0;" /></a>
                </div>
                <div style="height: 173px; overflow: hidden;">
                    <a href="#" target="_blank">
                        <img src="images/01.jpg" alt="" style="width:210px;height:170px;border:0;" /></a>
                </div>
                <!-- Marquee Body Bottom -->
            </div>
        </div>
        
</body>
</html>

解决方案 »

  1.   

    http://www.popub.net/script/MSClass.html
      

  2.   


    <!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=utf-8" />
    <title>无标题文档</title>
    </head><body>
     <script language="javascript" type="text/javascript">
    var obj_marquee;
    var marquee_spd = 4000;
    var step_c = 0;
    function marquee_init() {
      obj_marquee = document.getElementById("marquee");
      var obj_unit = obj_marquee.firstChild;
      var n = Math.ceil(parseInt(obj_marquee.style.height) / obj_unit.offsetHeight);
      for(var i=0; i<n; i++) obj_marquee.appendChild(obj_unit.cloneNode(true));
    setInterval("step_c=0;setTimeout('marquee_show()',50)", marquee_spd);
      return;
    }
    function marquee_show() {
      var marquee_high = parseInt(obj_marquee.style.height);
      var step = marquee_high/12;
      if(obj_marquee.scrollTop >= obj_marquee.children[1].offsetTop) {
        obj_marquee.scrollTop = 0;
        marquee_show();
        return;
      }
      obj_marquee.scrollTop += step;
      if(step_c++ < 12) setTimeout("marquee_show()", 50);
      return;
    }
    window.onload=marquee_init;
            </script>        <div id="marquee" style="overflow: hidden; padding: 0; height: 346px; width: 100%; border: 0px; padding: 0px;">
                <div style="border: 0px; padding: 0px">
                    <!-- Marquee Body Head -->
                    <div style="height: 173px; border: 0px; overflow: hidden;">
                        <a href="ad.html" target="_blank">
                            <img src="images/01.jpg" alt="" style="width:210px;height:170px;border:0;" /></a>
                    </div>
                    <div style="height: 173px; overflow: hidden;">
                        <a href="ad2.html" target="_blank">
                            <img src="images/01.jpg" alt="" style="width:210px;height:170px;border:0;" /></a>
                    </div>
                    <!-- Marquee Body Bottom -->
                </div>
            </div>
            
    </body>
    </html>
    再次请求高手出现。。解决火狐不兼容这段代码的疑惑
      

  3.   

    没发现,LZ开了两个贴啊?
    http://topic.csdn.net/u/20110114/18/a561f32f-c503-49af-82bf-35f8aa2f060c.html?seed=457836089&r=71234635#r_71234635我这上面这个贴有回复了。
    解决的话,个人建议,LZ在用firstChild或childNodes时,做个类型判断,否则的话,就有可能拿到一个TextNode来操作了。例如var node1=obj_marquee.firstChild;if(node1.nodeType==1)/*1为元素element,3为textNode.*/{obj_unit=node1;}或者,HTML代码不要格式化。例如<div id="marquee" style="overflow: hidden; padding: 0; height: 346px; width: 100%; border: 0px; padding: 0px;"><div style="border: 0px; padding: 0px"><div style="height: 173px; border: 0px; overflow: hidden;"><a href="ad.html" target="_blank"><img src="images/01.jpg" alt="" style="width:210px;height:170px;border:0;" /></a></div><div style="height: 173px; overflow: hidden;"><a href="ad2.html" target="_blank"><img src="images/01.jpg" alt="" style="width:210px;height:170px;border:0;" /></a></div></div></div>
    以上,仅供参考。