首页 新闻 会员 周边 捐助

文字左右滚动 火狐IE兼容

0
悬赏园豆:20 [已解决问题] 解决于 2009-11-19 13:05

求各位高人指点以下代码 跟火狐如何兼容啊?急…………

 

  <div id="gundongxinxi" style="width: 999px; height: 23px; overflow: hidden" onmouseover="stop()"
        onmouseout="start()">
        <table width="999" border="0" cellspacing="0" cellpadding="0" id="scrollimg" height="23">
            <tr>
                <td id="simg">
                    <table width="999" border="0" cellspacing="0" cellpadding="0" height="23">
                        <tr>
                            <td>
                                <a href="AboutMe.htm" style="color: #000000; font-weight: normal;">不间断文字滚动</a>
                            </td>
                        </tr>
                    </table>
                </td>
                <td id="simg1">
                </td>
            </tr>
        </table>

        <script language="JavaScript">
            var tm = null
            function newsScroll() {
                if (scrollimg.parentNode.scrollLeft != (scrollimg.clientWidth / 2))
                    scrollimg.parentNode.scrollLeft++;
                else
                    scrollimg.parentNode.scrollLeft = 0
            }
            window.onload = function() {
                simg1.innerHTML = simg.innerHTML
                tm = setInterval('newsScroll()', 20)
            }
            function stop() {
                clearInterval(tm)
            }

            function start() {
                tm = setInterval('newsScroll()', 20)
            }
        </script>
    </div>

凭栏处的主页 凭栏处 | 初学一级 | 园豆:45
提问于:2009-11-19 11:46
< >
分享
最佳答案
0

紅色字體改下就好了。需要用document.getElementById指定對象 

<div id="gundongxinxi" style="width: 999px; height: 23px; overflow: hidden" onmouseover="stop()"
            onmouseout="start()">
            <table width="999" border="0" cellspacing="0" cellpadding="0" id="scrollimg" height="23">
                <tr>
                    <td id="simg">
                        <table width="999" border="0" cellspacing="0" cellpadding="0" height="23">
                            <tr>
                                <td>
                                    <a href="AboutMe.htm" style="color: #000000; font-weight: normal;">不间断文字滚动</a>
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td id="simg1">
                    </td>
                </tr>
            </table>

            <script language="JavaScript">
            var tm = null
            var scrollimg=document.getElementById("scrollimg");
            var simg1=document.getElementById("simg1");
            var simg=document.getElementById("simg");

            function newsScroll() {
          
                if (scrollimg.parentNode.scrollLeft != (scrollimg.clientWidth / 2))
                    scrollimg.parentNode.scrollLeft++;
                else
                    scrollimg.parentNode.scrollLeft = 0
            }
            window.onload = function() {
           
                simg1.innerHTML = simg.innerHTML
           
                tm = setInterval('newsScroll()', 20)
            }
            function stop() {
                clearInterval(tm)
            }

            function start() {
                tm = setInterval('newsScroll()', 20)
            }
            </script>

        </div>

收获园豆:20
woody.wu | 老鸟四级 |园豆:3621 | 2009-11-19 12:40
哈哈……效果出来了……多谢了……
凭栏处 | 园豆:45 (初学一级) | 2009-11-19 13:05
其他回答(1)
0

可以考虑用marquee标签吧 如果滚动不是很复杂的话

如:

<marquee id="announcementList" style="HEIGHT:21px"  scrollamount="2" direction="left" onmouseover="stop()" onmouseout="start()">

滚动的内容
</marquee > 

落小呆 | 园豆:57 (初学一级) | 2009-11-19 11:53
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册