=波波日志 > JavaScript/Ajax > javascript横向滚动效果=
javascript横向滚动效果
javascript横向滚动效果,支持DOCTYPE xhtml申明
+展开
-HTML
<!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=utf-8" />
<title>无标题文档</title>
</head>
<body>
<table width="499 " border="1" cellpadding="0" cellspacing="0" bordercolor="#CC6600">
<tr>
<td width="495"><div id='demo' style='overflow:hidden;height:70px;width:400px'>
<div id=demo1> <a href='' target='_blank '> 这是滚动第1行 </a> <br>
这是滚动第2行 <br>
这是滚动第3行 <br>
这是滚动第4行 <br>
这是滚动第5行 <br>
这是滚动第6行 <br>
这是滚动第7行 <br>
这是滚动第8行 <br>
</div>
<div id='demo2'> </div>
</div>
<script>
var speed=20
var demo2 = document.getElementById("demo2");
var demo1 = document.getElementById("demo1");
demo2.innerHTML=demo1.innerHTML
function Marquee()
{
if(demo2.offsetTop-demo.scrollTop <=0)
demo.scrollTop-=demo1.offsetHeight
else
{
demo.scrollTop++
}
}
var MyMar=setInterval(Marquee,speed)
var demo=document.getElementById('demo');//=========
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>
</td>
</tr>
</table>
</body>
</html>
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<table width="499 " border="1" cellpadding="0" cellspacing="0" bordercolor="#CC6600">
<tr>
<td width="495"><div id='demo' style='overflow:hidden;height:70px;width:400px'>
<div id=demo1> <a href='' target='_blank '> 这是滚动第1行 </a> <br>
这是滚动第2行 <br>
这是滚动第3行 <br>
这是滚动第4行 <br>
这是滚动第5行 <br>
这是滚动第6行 <br>
这是滚动第7行 <br>
这是滚动第8行 <br>
</div>
<div id='demo2'> </div>
</div>
<script>
var speed=20
var demo2 = document.getElementById("demo2");
var demo1 = document.getElementById("demo1");
demo2.innerHTML=demo1.innerHTML
function Marquee()
{
if(demo2.offsetTop-demo.scrollTop <=0)
demo.scrollTop-=demo1.offsetHeight
else
{
demo.scrollTop++
}
}
var MyMar=setInterval(Marquee,speed)
var demo=document.getElementById('demo');//=========
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>
</td>
</tr>
</table>
</body>
</html>
类别:JavaScript/Ajax 作者:波波 日期:2010-06-18 【评论:0】
暂时没有评论!
发表留言
百度赞助
同类热门博文
- ·AJAX跨域问题解决办..
- ·ajax问题总结
- ·jQuery dataType指定..
- ·ajax+asp.net+mssql..
- ·ajax无刷新上传文件..
- ·ajax对象abort方法
- ·JavaScript代码,变..
- ·fckeditor编辑器在F..
博格Tag
- flash/flex/fcs/AIR(752)
- Asp.Net/C#/WCF(598)
- 操作系统及应用软件(376)
- JavaScript/Ajax(330)
- SQL及数据库(134)
- 黑客技术(115)
- Asp/VBScript(111)
- HTML/WML/CSS兼容/XML(102)
- PHP/apache/Perl(96)
- 网站排名及优化(96)
- 其他(75)
- showbo日志(66)
- lucene.net/分词技术(33)
- 计算机网络(26)
- 机械重工(26)
- C#设计模式(25)
- Google Maps开发(17)
- 日语学习(15)
- Canvas/VML/SVG(13)
- linux(11)
- 游戏开发(8)
- 正则表达式(5)
- Jsp/Java(4)
最新博文
- ·javascript实现html..
- ·Javascript风格要素..
- ·Javascript风格要素
- ·动态加载JavaScript
- ·JavaScript陷阱
- ·ajax技巧
- ·IE对CSS样式表的限制..
- ·什么是Javascript匿..
随机博文
