<!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>
解决方案 »
- 高分求教 jquery AutoComplete 发布到iis后不能显示的问题
- jquery中怎么用文档碎片呢(document.createDocumentFragment)
- LODOP插件使用方法
- 十万火急!!我想知道这段代码为什么放入HTML种无法显示访问来源!?在线等!!
- js parseInt(9999999999999999)的值为何会变成10000000000000000???
- 遞歸合并數組為何有錯?obj[i]=obj[i].replace(/#xxxx/,''); 有錯誤嗎?
- 请您指教。。。。。。。
- object中画线
- 关于 jQuery ready方法的疑问希望大神点通
- 我的javascript菜单出了点问题,不知道怎么
- 急问: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