ticker.js
2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
news = 2; // NEWS ‚Ì€–Ú”
frameNum = 30;
newsWidth =490;
speed = 30;
flip = 4 * 1000;
IE = document.all;
NN = document.layers;
SF = navigator.userAgent.indexOf('Safari') != -1;
N6 = !IE && !SF && document.getElementById
MAC = navigator.userAgent.indexOf('Mac') != -1;
VER = navigator.appVersion.charAt(0);
window.onload = init;
f = 0;
WNTO = 0;
function init() {
WNTO = setTimeout('scr(1);', flip);
f = frameNum / 2;
n = newsWidth / f;
if (NN && VER >= 4) {
nnX = document.HeadLine.pageX;
nnScr(n);
}
if (IE && VER >= 4) ieScr(n);
if (N6) n6Scr(n);
if (SF) sfScr(n);
}
function scr(n) {
clearTimeout(WNTO);
if (!f) {
f = frameNum;
n = n > 0 ? newsWidth * 2 / f : newsWidth * -2 / f;
if (NN && VER >= 4) nnScr(n);
if (IE && VER >= 4) ieScr(n);
if (N6) n6Scr(n);
if (SF) sfScr(n);
}
}
function nnScr(n) {
document.nnNews.left -= n;
if (document.nnNews.left > nnX) document.nnNews.left -= news * newsWidth * 2 + nnX;
if (document.nnNews.left < news * newsWidth * -2 + nnX) document.nnNews.left += news * newsWidth * 2;
document.nnNews.clip.left = nnX - document.nnNews.left;
document.nnNews.clip.right = nnX - document.nnNews.left + newsWidth;
if (--f) WNTO = setTimeout('nnScr(' + n + ')',speed);
else WNTO = setTimeout('scr(1);', flip);
}
function ieScr(n) {
x = adNews.document.body.scrollLeft + n;
if (x > news * newsWidth * 2) x -= news * newsWidth * 2;
if (x < 0) x += news * newsWidth * 2;
adNews.scrollTo(x,0);
if (--f) WNTO = setTimeout('ieScr(' + n + ')',speed);
else WNTO = setTimeout('scr(1);', flip);
}
function n6Scr(n) {
x = adNews.pageXOffset + n;
if (x > news * newsWidth * 2) x -= news * newsWidth * 2;
if (x < 0) x += news * newsWidth * 2;
adNews.scrollTo(x,0);
if (--f) WNTO = setTimeout('n6Scr(' + n + ')',speed);
else WNTO = setTimeout('scr(1);', flip);
}
function sfScr(n) {
x = adNews.scrollX + n;
if (x > news * newsWidth * 2) x -= news * newsWidth * 2;
if (x < 0) x += news * newsWidth * 2;
adNews.scrollTo(x,0);
if (--f) WNTO = setTimeout('sfScr(' + n + ')',speed);
else WNTO = setTimeout('scr(1);', flip);
}