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

|
网页之跑马灯文字特效
//修改宽度
; C; _6 |( o# r, P. R svar marqueewidth=300
* F0 y3 \8 U5 I/ {$ I, s//高度
2 }9 z) D6 \5 D$ V, m3 u( I! `var marqueeheight=25
$ S4 Q# z& a& W0 s" v//速度(1-10) [% n7 Z/ V8 {) v- ^. f& }, z$ i
var marqueespeed=3
% V, l8 Y* i s' Q. x8 F; y//背景颜色
. W% p4 T; f3 ?( T" _+ zvar marqueebgcolor="#FFFFFF"6 l; Z2 X% j' j& x- ^0 O9 \
//是否能暂停 (0=no. 1=yes)?
' l% r$ o" u% K! c d! k& Vvar pauseit=17 C& E- _' u2 q! \, _5 `
- K3 L' e" q0 U, Q6 `) E1 B# A//修改显示内容 ]1 w2 R5 R1 M' ]4 Z! k
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% z4 g" \, x9 o$ d4 G! N3 m* I
2 u+ \( S3 X' A3 h6 Y( U* @) c9 H$ q# n1 C* B. ^' L9 m
////下面不需改变////////////% O' G4 ^2 ~% G/ q3 ]: r9 z2 \
4 ]: N+ E# U: |% Y: ]) T
var copyspeed=marqueespeed8 c2 c% N1 D/ j. e
var pausespeed=(pauseit==0)? copyspeed: 0
2 {: C! e9 T9 g# a( Wvar iedom=document.all||document.getElementById
; P( f% Q+ A0 ^# ?! S6 W+ I2 Lif (iedom)0 n- s3 b: k" h5 S1 R7 G
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' \, @% _& p4 q- c. \6 Ovar actualwidth=''
" ? W- J9 P3 [" Qvar cross_marquee, ns_marquee
+ g: i" j5 C8 U5 A& ?3 R4 b" O. ^
4 e2 q8 r/ g& B' _function populate(){
5 \3 Z% A5 L; A M% Q* r, `if (iedom){" K1 F) A, J! v1 H1 a2 |
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
. [- W+ a% g. B0 r. r% gcross_marquee.style.left=marqueewidth+8
/ s4 H- n# G/ z" j: Qcross_marquee.innerHTML=marqueecontent
; K; N& h: b) vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, }! _! S* P7 \- A, u8 S5 _0 e& f6 x6 S}
9 E" ~0 S* X* o: V, H& m7 nelse if (document.layers){
3 f: S7 a G9 i6 ?8 }ns_marquee=document.ns_marquee.document.ns_marquee2. K, j0 l. v6 {( |- D9 }4 u
ns_marquee.left=marqueewidth+8
j- S3 }9 Y: s4 L( I& }ns_marquee.document.write(marqueecontent)+ z" l% c4 c. n6 T0 m
ns_marquee.document.close()
0 |0 G8 O( I% jactualwidth=ns_marquee.document.width- k) Y% f) f G" ]& t% I
}* t4 t R" _7 X9 x8 p
lefttime=setInterval("scrollmarquee()",20)3 F" L Y2 S3 X3 L$ v
}0 p$ a; X7 k$ F0 D2 B8 F/ x
window.onload=populate
& L' w9 ^# m' j. c3 m1 Y3 R5 e7 A$ C: G9 g3 r/ W2 J+ A1 s# w. x% a/ C
function scrollmarquee(){
2 O. @- p: s1 G% Jif (iedom){
2 B$ r" g: K3 E& S* w! P% Iif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( \2 y1 j5 L2 d& L9 |! M& |
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 Q! H* b- z3 E! Y' g' z
else
% T! Q* d; u; v# ocross_marquee.style.left=marqueewidth+80 n* @$ ]2 h+ e; C- z
' I! |/ h) w W2 S% Z}* X: Q, A( q5 V3 q1 _ N0 u3 q% n
else if (document.layers){- M9 |/ n2 q; u0 u2 t, ?
if (ns_marquee.left>(actualwidth*(-1)+8))6 \: w% X( }; [, @/ J5 H
ns_marquee.left-=copyspeed3 L; V& U- j. f8 {2 n
else
, {2 X9 ^1 k9 q: }' q0 bns_marquee.left=marqueewidth+8
8 m, @4 R: l" q- O: o; w' S1 I" i}
1 w B" r; |8 ^: ]}7 I4 }) b& G7 o" e. U( o8 J% a
" Z# q) a* c7 E9 t/ k9 Nif (iedom||document.layers){. h8 \5 f. W9 S2 D% ^: P
with (document){
! ^# C% Q: d' j6 I+ c+ Udocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 l2 @6 G C2 xif (iedom){6 U9 }' E- Q6 p
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 K1 s3 U1 `# i: ~4 c1 t9 M9 |write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* M3 d9 L7 h) K8 i9 a" g* i1 I
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' P. d! Y; ?& e8 x
write('</div>')
, {4 |8 K6 E7 m7 c7 l} @8 V. }6 g% i7 r" _ S4 \
else if (document.layers){7 f8 a3 d3 e% f1 J4 B( y8 z- _5 ?
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ t1 k, g- Y( N# N4 Pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): o$ K& E9 {( C7 X
write('</ilayer>')
! T& k+ B/ t8 w* N}
. H) e5 D" g% N2 a& pdocument.write('</td></table>')
# t$ j; v) H! o$ I}, }) x9 T6 W; A8 c0 D/ U; j
}
! e& ], F+ ^7 I/ S- S7 x</script> |
|