|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度6 D$ b5 n9 [, u7 e
var marqueewidth=300
& ~8 ]9 L8 y( [# Y7 l//高度
7 V! m* k% I* \& m5 evar marqueeheight=25
( M: Q% e5 B y5 E" \, R//速度(1-10)
; e% K+ Q O7 c" \5 ^& \' @( Mvar marqueespeed=3
7 Y) i6 p8 |' N7 R7 x/ G//背景颜色/ Q% Y9 X" G7 {
var marqueebgcolor="#FFFFFF"$ v! j' j4 ^: s8 i" S$ S
//是否能暂停 (0=no. 1=yes)?) i/ |: o* Z+ H: b+ u: C( K6 z4 d
var pauseit=17 h1 }3 B, J2 K9 ?- {
1 O# x8 L9 T) h, [9 X M: C3 C9 j) V
//修改显示内容6 z2 d+ P0 B+ c# O; y. W
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
4 F, j. t( A7 p! W% v2 X6 u- O: P7 w/ D3 q" H
6 A9 E' c. H% x# U
////下面不需改变////////////; b4 T) G3 V. |$ x T5 E
6 y0 k+ I' h* `$ Qvar copyspeed=marqueespeed: V& g3 q+ {1 x
var pausespeed=(pauseit==0)? copyspeed: 0, i; P8 `3 [% ~
var iedom=document.all||document.getElementById
: q- u* y6 _ o. a- e; Eif (iedom)7 L$ w" y. H0 {8 L; w4 M: U
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'); q W' v! L' q. f: [7 Q7 p# O
var actualwidth=''
) L5 ^" x4 s( ~- z( Bvar cross_marquee, ns_marquee
6 s3 e& p0 G4 V, \/ p+ N% W. b
function populate(){
8 S/ Z( d4 B5 X) g# eif (iedom){ \( U, C) p0 `, D
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* q- B2 Q9 |4 b2 n
cross_marquee.style.left=marqueewidth+8. W" `# j7 U1 q/ r: [" I7 B3 m4 v
cross_marquee.innerHTML=marqueecontent$ y7 J/ Z& S( R5 b# p% J6 f6 v
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 w6 [9 N, ]) J6 M! y- S P
}( j8 N; j6 r% N, ^
else if (document.layers){
2 E; D/ f" G9 Ans_marquee=document.ns_marquee.document.ns_marquee2+ o Z9 Z$ s2 @. Q8 l; ]3 w* X
ns_marquee.left=marqueewidth+88 X* R. c8 |! K
ns_marquee.document.write(marqueecontent)
9 n5 B) n- q1 d4 |# w7 z: Wns_marquee.document.close()
9 e) V v! ^0 o9 Q2 X2 y2 M$ z5 gactualwidth=ns_marquee.document.width
1 d9 R$ v# W" _ m- f8 l* D; g}# N/ u/ L$ N. V7 H
lefttime=setInterval("scrollmarquee()",20)
$ B1 i* [ U; R; |7 W}
) V, N. m) y. N' q- O+ {& c" i' F; Lwindow.onload=populate
' _, i: Y2 T. @* m8 c1 n5 ]; u9 m, k0 ]4 e$ ]
function scrollmarquee(){
0 q2 k: e% m5 Z" Cif (iedom){
, N I+ { s4 c' Q8 `if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, ]' M$ q3 s1 s$ K& w, Mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" v7 Z. H- M3 i4 U9 G2 ^+ I0 k( n
else
' W* u1 s' f6 u" kcross_marquee.style.left=marqueewidth+8
% s) E/ g% [; F$ M: V! Y' F2 W9 b/ p
}
( v; \6 i! J% Xelse if (document.layers){
% L% N+ K! P; P. ?& }0 U9 Rif (ns_marquee.left>(actualwidth*(-1)+8))
, T; c! S* p4 m1 r5 e9 w1 ]7 a4 Z/ zns_marquee.left-=copyspeed, ?. T' C3 o( E1 @ N$ r$ \: O
else
" ]7 p+ B. k, K6 V3 o. E7 qns_marquee.left=marqueewidth+85 D7 N9 @1 n- q2 b7 a
}1 S8 O) z: t) x: y3 o8 ], k9 A; G, ~
}
% b# E' g. ?- L2 a, ]
# h8 n2 F; f3 @+ Z# E5 a- t2 ^+ dif (iedom||document.layers){( E2 i0 E b$ r! m5 v
with (document){
( ?6 _7 t0 a( C( Y$ h, G9 `& _document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( l! P; ]& q, E Y3 e( J/ L, R( n6 d) @2 Qif (iedom){
+ K$ q+ n) y; K2 z8 `) j0 ^write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
: Z( l' [. q( u% Wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 ]1 G+ p/ O, s6 k8 n
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 ?% ]* H- N9 A* r# D5 n
write('</div>')" t4 B8 \1 N& R+ \
}
8 ^* i- d% U- G* s, n7 Yelse if (document.layers){0 E% \7 @ H8 s5 p; W( `( F! N; b' }
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- n+ ^# N# L* T/ t1 D4 Gwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! \! d, Y I) E9 \* iwrite('</ilayer>')- X0 P2 U6 m2 x& D" z+ F& k$ [
} |; W8 Y0 ]; R$ c
document.write('</td></table>')
. X% D# H6 I1 ^' e; k: Z" f}
$ M" `2 K2 D, \. G6 c$ k- Z}
. H& N4 O. F$ v; F* g* N</script> |
|