JS实现新闻滚动效果
2013-01-07 16:59
603 查看
具体代码如下:
<!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>
<title>code.js.cn </title>
<style>
a
{
display: block;
font-size: 15px;
line-height: 18px;
text-decoration: none;
color: #333;
font-family: Arial;
font-size: 12px;
}
.shell
{
background:no-repeat 4px 5px;
border: 1px solid #aaa;
width: 400px;
padding: 3px 2px 2px 20px;
}
#div1
{
height: 36px;
overflow: hidden;
}
</style>
</head>
<body>
<div class="shell">
<div id="div1">
<a>这是</a>
<a>我的</a>
<a>第一篇</a>
<a>博客</a>
</div>
</div>
</body>
<script>
var c, _ = Function;
with (o = document.getElementById("div1")) { innerHTML += innerHTML; onmouseover = _("c=1"); onmouseout = _("c=0"); }
(F = _("if(#%18||!c)#++,#%=o.scrollHeight>>1;setTimeout(F,#%18?10:3000);".replace(/#/g, "o.scrollTop")))();
</script>
</html>
滚动频率由setTimeout(F,#%18?10:3000)这个3000来控制。
<!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>
<title>code.js.cn </title>
<style>
a
{
display: block;
font-size: 15px;
line-height: 18px;
text-decoration: none;
color: #333;
font-family: Arial;
font-size: 12px;
}
.shell
{
background:no-repeat 4px 5px;
border: 1px solid #aaa;
width: 400px;
padding: 3px 2px 2px 20px;
}
#div1
{
height: 36px;
overflow: hidden;
}
</style>
</head>
<body>
<div class="shell">
<div id="div1">
<a>这是</a>
<a>我的</a>
<a>第一篇</a>
<a>博客</a>
</div>
</div>
</body>
<script>
var c, _ = Function;
with (o = document.getElementById("div1")) { innerHTML += innerHTML; onmouseover = _("c=1"); onmouseout = _("c=0"); }
(F = _("if(#%18||!c)#++,#%=o.scrollHeight>>1;setTimeout(F,#%18?10:3000);".replace(/#/g, "o.scrollTop")))();
</script>
</html>
滚动频率由setTimeout(F,#%18?10:3000)这个3000来控制。
相关文章推荐
- js新闻滚动 js如何实现新闻滚动效果
- js实现滚动新闻效果
- js新闻滚动 js如何实现新闻滚动效果
- <js>jquery实现新闻滚动效果,ie11支持
- js实现新闻条目滚动效果
- Flash 新闻效果(js实现)
- js实现仿微博滚动显示信息的效果
- Asp.net marquee与js实现滚动效果
- 分别用marquee和div+js实现首尾相连循环滚动效果,仅3行代码
- JS实现部分HTML固定页面顶部随屏滚动效果
- [js]网页侧边随页面滚动广告效果实现
- 前端js实现新闻列表数据动态滚动效果的函数
- 新闻滚动效果JQuery实现
- js实现淘宝首页图片轮播效果(修正图片滚动顺序的问题)
- 利用JavaScript实现新闻滚动效果(实例代码)
- js实现文字滚动效果
- js实现带按钮的上下滚动效果
- js实现带按钮的上下滚动效果
- marquee标签不用js实现滚动效果
- js 实现文字列表滚动效果