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

|
网页之跑马灯文字特效
//修改宽度
4 p9 M7 c+ d5 F7 hvar marqueewidth=3008 X- ^. `; e- @% B* p
//高度
$ `% U3 W# I, z5 Jvar marqueeheight=25
0 Q& a( C, w% q$ o3 a9 j) V//速度(1-10)
0 B/ Y+ P: T5 Q+ ^) Pvar marqueespeed=30 p8 A7 a. B1 d; ?" g4 M
//背景颜色+ a! F1 U4 b+ {( e* Q3 W1 t; S1 u
var marqueebgcolor="#FFFFFF"6 C6 E! m. d7 ^2 G; @ |, g
//是否能暂停 (0=no. 1=yes)?
" m: F- e$ _' S5 g) _4 E# f$ svar pauseit=10 Q+ {4 y/ \2 W1 @& c
- ~- o6 J% f! |- ~//修改显示内容1 ?/ X7 a: V9 K- G
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>' W) q+ p o: x0 M' m" a6 d* b
0 f- G e3 r7 h1 ~) }6 Z
7 A" ^( ?1 d" Z) y3 q0 p* O////下面不需改变////////////
. ]. E3 A: b. g1 N- {) D5 _5 ?+ \$ I5 K7 l
var copyspeed=marqueespeed
- i; u* u7 D. ` O- p% i" Svar pausespeed=(pauseit==0)? copyspeed: 00 i( n# @( P% B& T$ ]4 R( Y
var iedom=document.all||document.getElementById
, K* ]/ t; a4 X7 gif (iedom)
# C- R: f4 C1 c p. X; Ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 |: E% i d! E/ Q9 l, _+ Xvar actualwidth=''( y0 I5 F4 ]) W* y+ ]( q
var cross_marquee, ns_marquee
% [" Y9 [6 b1 O" P8 l7 `8 G' F* G6 v& v2 d" l) ~3 G( F
function populate(){
3 W4 Y) ]; f! M5 c H; \. Fif (iedom){( K# W: r& b4 ~7 A7 W' T- o
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 i+ d. z4 X0 ]cross_marquee.style.left=marqueewidth+8
. {; a& b7 l2 L ]5 ecross_marquee.innerHTML=marqueecontent" h# v9 k. y8 M: E
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth8 M) [1 i! b: g7 j- v2 [, `
}
1 v/ r1 O/ A. G1 s5 V: ]6 \! lelse if (document.layers){7 f0 H ?! L$ E F: f
ns_marquee=document.ns_marquee.document.ns_marquee23 j1 Z7 D, b# L- g2 \* |
ns_marquee.left=marqueewidth+8" x N* w) z& S! K, |
ns_marquee.document.write(marqueecontent)# u: h' b/ w7 j3 e- \1 \
ns_marquee.document.close()
) o% T: K T/ F3 m* c$ S2 V8 Dactualwidth=ns_marquee.document.width
& b: F- u# x- h}! k" r; ^+ {1 d7 E6 n
lefttime=setInterval("scrollmarquee()",20): H, a, C6 K: K6 w
}
9 `, w6 F# f; \+ S2 G4 ewindow.onload=populate& Q- @6 w% S/ R; G+ a
7 S v; u: t. O& o4 n/ k" J' {8 \: Y
function scrollmarquee(){
+ Z7 w( q# {1 l8 Y* a7 Pif (iedom){0 E) l( o0 a q5 I
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))- B( }( O* O1 h4 I' t0 _
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; w" h6 ^3 E6 F# _! B, C; O Q! felse" B& z/ @1 \2 C6 N9 W3 t; Z# L+ A/ l4 ^3 d
cross_marquee.style.left=marqueewidth+8
7 E9 E7 c: B( w% }: X. t/ u( D+ P R( t! Z' @
}
! q: ~. M. ?" Zelse if (document.layers){
! a' F" e) y: ^ G' rif (ns_marquee.left>(actualwidth*(-1)+8))
' Q- Z. M3 R+ Tns_marquee.left-=copyspeed0 [9 Z. ~( |7 T' H" D6 j
else. I0 G( L$ ?$ _) A2 H) k# z
ns_marquee.left=marqueewidth+85 D7 l2 F3 e5 N4 A
}3 J0 v0 o7 B( u
}
) ]- K! ^) a6 r/ F$ o- Z9 ?/ Z/ I% l( ], @
if (iedom||document.layers){3 `6 J* y2 S& Y/ k
with (document){: w( W! S v6 D. @; |5 F, ] q
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# f3 Z. r1 u$ L3 n) Bif (iedom){9 k+ W8 q' K" G E* c* Y& I% {
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 a# X4 y. s0 y- s) c/ k) a v
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
g8 V4 Y) e0 V# u4 [# ]( u' bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ m. ]1 a0 X; d) _3 E8 O. b H0 Y) V( gwrite('</div>')
( a, x, Q/ d6 F/ s" q8 n9 p& C}% ]- u2 |5 q$ h5 \& L+ e
else if (document.layers){& n) i% j6 n4 M4 T1 l
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# ` l6 f. ~4 f! F0 g# o5 P- owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# }; z f6 ]( w. g" o* ^
write('</ilayer>')
% Q2 @3 S. q; E! r/ z}
8 s4 f9 z" c- @! C; udocument.write('</td></table>')
! _- |$ C) \; A- ]1 ~$ V! N}
$ |* |1 M/ c* @6 H}
8 I$ q" s+ \; R7 g+ A( Y" [/ Y</script> |
|