<!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=gb2312" />
<title>无标题文档</title>
</head><body>
<div id="demo" style="overflow:hidden;height:33;width:500;background:#214984;color:#ffffff; border:1px solid red">
<table align="left" cellpadding="0" cellspacing="0" border="0">
<tr>
<td id="demo1" valign="top">
<img src="http://www.baidu.com/img/baidu_logo.gif">
<img src="http://www.baidu.com/img/baidu_logo.gif">
<img src="http://www.baidu.com/img/baidu_logo.gif">
<img src="http://www.baidu.com/img/baidu_logo.gif">
<img src="http://www.baidu.com/img/baidu_logo.gif">
</td>
<td id="demo2" valign="top"></td>
</tr>
</table>
</div><script>
var speed=30
demo2.innerHTML=demo1.innerHTML
function Marquee()
{
if(demo2.offsetWidth-demo.scrollLeft<=0)
{
demo.scrollLeft-=demo1.offsetWidth
}
else
{
demo.scrollLeft++
}
}
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script> </body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head><body>
<div id="demo" style="overflow:hidden;height:33;width:500;background:#214984;color:#ffffff; border:1px solid red">
<table align="left" cellpadding="0" cellspacing="0" border="0">
<tr>
<td id="demo1" valign="top">
<img src="http://www.baidu.com/img/baidu_logo.gif">
<img src="http://www.baidu.com/img/baidu_logo.gif">
<img src="http://www.baidu.com/img/baidu_logo.gif">
<img src="http://www.baidu.com/img/baidu_logo.gif">
<img src="http://www.baidu.com/img/baidu_logo.gif">
</td>
<td id="demo2" valign="top"></td>
</tr>
</table>
</div><script>
var speed=30
demo2.innerHTML=demo1.innerHTML
function Marquee()
{
if(demo2.offsetWidth-demo.scrollLeft<=0)
{
demo.scrollLeft-=demo1.offsetWidth
}
else
{
demo.scrollLeft++
}
}
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script> </body>
</html>
解决方案 »
- Ext 中将后台id的值传给window组件中TabPanel怎么做?
- Javascript 特效求救
- 如何把它们改成变量?
- 如何通过javascript获得session的ID值
- 我的一个JS方法问题,为什么我动态添加一个<img>出现了下面的问题
- 帮助找个示例:信息提示类
- Myeclipse 8.5中JS文件,报style、contentDocument等找不到
- 怎样取<select></select>中被选中的值?
- 用正则表达式验证用户名密码都是字母或者数字,怎么老提示输入有误?
- 关于 js 弹出层插件
- 急问:JS如何展开某一项
- 如何在.js文件中,得到我们所嵌入jsp或者html页面的document
FF下有不少的错误。
var speed=30
demo2.innerHTML=demo1.innerHTML
function Marquee()
{
if(demo2.offsetWidth-demo.scrollLeft <=0)
{
demo.scrollLeft-=demo1.offsetWidth
}
else
{
demo.scrollLeft++
}
}
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script> 换成<script>
var demo=document.getElementById("demo").
var demo1=document.getElementById("demo1").
var demo2=document.getElementById("demo2")
var speed=30
demo2.innerHTML=demo1.innerHTML
function Marquee()
{
if(demo2.offsetWidth-demo.scrollLeft <=0)
{
demo.scrollLeft-=demo1.offsetWidth
}
else
{
demo.scrollLeft++
}
}
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>
http://blog.csdn.net/chinmo/archive/2008/09/12/2915629.aspx