文字图片左右滚动 火狐IE兼容
页面详细代码(比较懒,不详细分析)
<html>
<head>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<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="#" 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>
</form>
</body>
</html>
marquee标签也可以简单实现滚动效果
<marquee id="announcementList" style="HEIGHT:21px" scrollamount="2" direction="left" onmouseover="stop()" onmouseout="start()">
滚动的内容
</marquee >