您的位置:首页 > Web前端 > JavaScript

js 文字上下间隔滚动代码

2009-12-08 09:34 369 查看
js 文字上下间隔滚动代码

1 <html>
2 <head>
3 <meta http-equiv="content-type" content="text/html;charset=utf-8" />
4 <style type="text/css">
5 #icefable1 {
6 margin-top: 2px; background: #494c6e; color: #ffff00; line-height: 26px; height: 26px; text-decoration: none
7 }
8 #icefable1 div {
9 padding-left: 30px; background: url(../images/index/point_style_00.gif) no-repeat 12px 4px; width: 350px
10 }
11 #icefable1 a:hover {
12 color: #656a82; line-height: 26px
13 }
14 </style>
15 </head>
16 <body>
17 <div id="icefable1">
18 <div>
19 欢迎访问<a href="http://webym.cn/blog" target="_blank">http://webym.cn/blog</a>" target="_blank"><a
20 href="http://webym.cn/blog" target="_blank">http://webym.cn/blog</a></a></div>
21 <div>
22 aidli.com/bbs地理论坛诚征版主中...</div>
23 <div>
24 邮箱: yangzhy@163.com</div>
25 <div>
26 广告合作:qq164890072</a>
27 </div>
28 </div>
29
30 <script>
31 marqueesheight=26;
32 stopscroll=false;
33 with(icefable1)
34 {
35 style.width=0;
36 style.height=marqueesheight;
37 style.overflowx="visible";
38 style.overflowy="hidden";
39 nowrap=true;
40 onmouseover=new function("stopscroll=true");
41 onmouseout=new function("stopscroll=false");
42 }
43 pretop=0;
44 currenttop=marqueesheight;
45 stoptime=0;
46 icefable1.innerhtml+=icefable1.innerhtml;
47
48 function init_srolltext()
49 {
50 icefable1.scrolltop=0;
51 setinterval("scrollup()",1);
52 }
53 init_srolltext();
54
55 function scrollup()
56 {
57 if(stopscroll==true) return;
58 currenttop+=1;
59 if(currenttop==marqueesheight+1)
60 {
61 stoptime+=1;
62 currenttop-=1;
63 if(stoptime==300)
64 {
65 currenttop=0;
66 stoptime=0;
67 }
68 }
69 else
70 {
71 pretop=icefable1.scrolltop;
72 icefable1.scrolltop+=1;
73 if(pretop==icefable1.scrolltop)
74 {
75 icefable1.scrolltop=marqueesheight;
76 icefable1.scrolltop+=1;
77 }
78 }
79 }
80 init_srolltext();
81 </script>
82
83 </body>
84 </html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: