本帖最后由 yollxt 于 2009-10-20 13:40:38 编辑

解决方案 »

  1.   

    这样?<html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
            <title>banner</title>
            <style type="text/css">
                <!--
                body {            }
                -->
            </style></head>
        <body>
            <table width="728"  border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                    <td width="989">
                        <div id="icefable1" style="overflow:hidden;width:600px;height:60px;">
                            <table width="728"  border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td width="728" height="60" bgcolor="#0099CC">1</td>
                                </tr>
                                <tr>
                                    <td height="65" bgcolor="#00FFCC">2</td>
                                </tr>
                            </table>                    </div>
                    </td>
                </tr>
            </table>
            <script>
                var marqueesHeight=60;
                var stopscroll=false;
                var icefable1=document.getElementById("icefable1");
                with(icefable1){
                    style.height=marqueesHeight+"px";
                    onmouseover=new Function("stopscroll=true");
                    onmouseout=new Function("stopscroll=false");
                }
                var preTop=0;
                var currentTop=marqueesHeight;
                var stoptime=0;
                //icefable1.innerHTML+=icefable1.innerHTML;            function init_srolltext(){
                    icefable1.scrollTop=0;
                    setInterval("scrollUp()",1);
                }
                init_srolltext();
                var flag=false;
                function scrollUp(){
                    if(stopscroll==true) return;
                    currentTop+=1;
                    if(currentTop==marqueesHeight+1)
                    {
                        stoptime+=1;
                        currentTop-=1;
                        if(stoptime==30)
                        {
                            currentTop=0;
                            stoptime=0;
                            stopscroll=false
                        }
                    }
                    else {
                        preTop=icefable1.scrollTop;
                        if(!flag) {
                            icefable1.scrollTop++;
                            if(preTop==icefable1.scrollTop){
                                icefable1.scrollTop=marqueesHeight;
                                currentTop=0;
                                flag=true;
                            }
                        }
                        else {
                            icefable1.scrollTop--;
                            if(icefable1.scrollTop==0){
                                icefable1.scrollTop=0;
                                currentTop=marqueesHeight;
                                stoptime=0
                                flag=false;
                            }
                        }
                        
                        
                    }
                }
               
            </script>
        </body>
    </html>
      

  2.   


    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
            <title>banner</title>
            <style type="text/css">
                <!--
                body {            }
                -->
            </style></head>    <body>
            <table width="728"  border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                    <td width="989">
                        <div id="icefable1" style="overflow:hidden;width:600px;height:60px;">
                            <table width="728"  border="0" cellpadding="0" cellspacing="0" id="tb">
                                <tbody>
                                    <tr>
                                        <td width="728" height="60" bgcolor="#0099CC">1</td>
                                    </tr>
                                    <tr>
                                        <td height="60"  width="728" bgcolor="#00FFCC">2</td>
                                    </tr>
                                </tbody>
                            </table>                    </div>
                    </td>
                </tr>        </table>
            <input type="button" value="sss" onclick=" change()">
            <script>
                var marqueesHeight=60;
                var stopscroll=false;            var icefable1=document.getElementById("icefable1");
                with(icefable1){
                    style.height=marqueesHeight+"px";
                    onmouseover=new Function("stopscroll=true");
                    onmouseout=new Function("stopscroll=false");
                }
                var preTop=0;
                var currentTop=marqueesHeight;
                var stoptime=0;
                //icefable1.innerHTML+=icefable1.innerHTML;
                function init_srolltext(){
                    icefable1.scrollTop=0;
                    setInterval("scrollUp()",1);
                }
                init_srolltext();            function scrollUp(){
                    if(stopscroll==true) return;
                    currentTop+=1;
                    if(currentTop==marqueesHeight+1)
                    {
                        stoptime+=1;
                        currentTop-=1;
                        if(stoptime==30)
                        {
                            currentTop=0;
                            stoptime=0;
                            
                        }
                    }
                    else {
                        preTop=icefable1.scrollTop;
                        icefable1.scrollTop+=1;
                        if(preTop==icefable1.scrollTop){
                            icefable1.scrollTop=marqueesHeight;
                            icefable1.scrollTop=0;             
                            change()
                           
                        }
                    }
                }
                function change(){
                    var tb=document.getElementById("tb");
                    var tr1=tb.rows[0];
                    var tr2=tb.rows[1];
                    var newtr1=document.createElement("tr");
                    var newtr2=document.createElement("tr");
                    newtr1=tr1;
                    newtr2=tr2;
                    if(document.all){
                        tb.childNodes[0].insertBefore(newtr2, newtr1)
                    }else{
                        tb.deleteRow(0)
                        tb.deleteRow(0)
                        tb.insertRow(0);
                        tb.insertRow(0);
                        tb.rows[0].appendChild(tr2);
                        tb.rows[1].appendChild(tr1);
                    }
                   
                    
                    //
                }
                //init_srolltext();
            </script>
        </body>
    </html>
      

  3.   

    http://www.cnblogs.com/blueskyc/archive/2008/07/01/1233076.html
      

  4.   


    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
            <title>banner</title>
            <style type="text/css">
                <!--
                body {            }
                -->
            </style></head>    <body>
            <table width="728"  border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                    <td width="989">
                        <div id="icefable1" style="overflow:hidden;width:600px;height:60px;">
                            <table width="728"  border="0" cellpadding="0" cellspacing="0" id="tb">
                                <tbody>
                                    <tr>
                                        <td width="728" height="60" bgcolor="#0099CC">1</td>
                                    </tr>
                                    <tr>
                                        <td height="60"  width="728" bgcolor="#00FFCC">2</td>
                                    </tr>
                                </tbody>
                            </table>                    </div>
                    </td>
                </tr>        </table>
            <script>
                var marqueesHeight=60;
                var stopscroll=false;            var icefable1=document.getElementById("icefable1");
                with(icefable1){
                    style.height=marqueesHeight+"px";
                    onmouseover=new Function("stopscroll=true");
                    onmouseout=new Function("stopscroll=false");
                }
                var preTop=0;
                var currentTop=marqueesHeight;
                var stoptime=0;
                //icefable1.innerHTML+=icefable1.innerHTML;
                function init_srolltext(){
                    icefable1.scrollTop=0;
                    setInterval("scrollUp()",1);
                }
                init_srolltext();            function scrollUp(){
                    if(stopscroll==true) return;
                    currentTop+=1;
                    if(currentTop==marqueesHeight+1)
                    {
                        stoptime+=1;
                        currentTop-=1;
                        if(stoptime==30)
                        {
                            currentTop=0;
                            stoptime=0;
                        }
                    }
                    else {
                        preTop=icefable1.scrollTop;
                        icefable1.scrollTop+=1;
                        if(preTop==icefable1.scrollTop){
                            currentTop=0;
                            icefable1.scrollTop=marqueesHeight;
                            icefable1.scrollTop=0;                     
                            change()
                           
                        }
                    }
                }
                function change(){
                    var tb=document.getElementById("tb");
                    var tr1=tb.rows[0];
                    var tr2=tb.rows[1];
                    var newtr1=document.createElement("tr");
                    var newtr2=document.createElement("tr");
                    newtr1=tr1;
                    newtr2=tr2;
                    if(document.all){
                        tb.childNodes[0].insertBefore(newtr2, newtr1)
                    }else{
                        tb.deleteRow(0)
                        tb.deleteRow(0)
                        tb.insertRow(0);
                        tb.insertRow(0);
                        tb.rows[0].appendChild(tr2);
                        tb.rows[1].appendChild(tr1);
                    }
                   
                    
                    //
                }
                //init_srolltext();
            </script>
        </body>
    </html>
      

  5.   

    还是有一点卡卡的哦,能再看看吗?谢谢~BeenZ