求各位高人指点以下代码 跟火狐如何兼容啊?急…………
<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>
紅色字體改下就好了。需要用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>
可以考虑用marquee标签吧 如果滚动不是很复杂的话
如:
<marquee id="announcementList" style="HEIGHT:21px" scrollamount="2" direction="left" onmouseover="stop()" onmouseout="start()">
滚动的内容
</marquee >