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

|
网页之跑马灯文字特效
//修改宽度
! T1 k5 }% P3 X/ [var marqueewidth=300
9 k5 ^7 T, Z/ Q/ R* X; l//高度
0 L% Z% V9 D1 N9 p7 qvar marqueeheight=253 p9 w0 j0 G# G1 b }
//速度(1-10)
' w. u* e( v$ k$ J) cvar marqueespeed=3) U" c: `+ D" i- m" |) c% E
//背景颜色/ O9 F, c" _6 W) Y
var marqueebgcolor="#FFFFFF"' y& g( a0 M5 H* h2 C; i
//是否能暂停 (0=no. 1=yes)?! N; t6 e" ?1 I) F/ d) d8 `8 G/ I
var pauseit=1) B& B7 B( G! @4 K5 H6 J
2 ^4 j' x' R4 Z7 H' N//修改显示内容- f& F& l5 f6 e" B" a9 N# M
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>', [* i8 p0 {7 Q
8 ?; e! U3 ]8 P) l2 W+ l2 j3 {- B/ B$ ^4 B' {) K' i7 \6 p
////下面不需改变////////////# b/ ^$ G6 l" i' g( w
+ a, V0 f+ M" F
var copyspeed=marqueespeed
- G" r4 I; @; y2 n4 e0 I$ M% M/ yvar pausespeed=(pauseit==0)? copyspeed: 0
+ N. a# D6 C, R$ V* x1 e; cvar iedom=document.all||document.getElementById
/ D5 M. v$ m& }1 _/ Gif (iedom)) i- W. V: G2 q. Y6 @& f$ m
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' ^& G* |/ ~4 fvar actualwidth=''+ `$ i3 Y/ b7 e7 I
var cross_marquee, ns_marquee5 p: e: l9 X! g# U, H( S; u
( g' _2 u- s; y) d. n) R' o
function populate(){
- w: E5 E$ ~7 c$ h- uif (iedom){
% x6 Q0 `/ `/ scross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: c3 m! |7 l/ vcross_marquee.style.left=marqueewidth+8% x6 A% M; x; s0 E& C
cross_marquee.innerHTML=marqueecontent1 b: N, H6 Z7 G# O2 B0 ?' Q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
R2 ~8 w2 {. `) M+ l}
" @- W( S: h+ A5 k; M; H8 [else if (document.layers){
0 a6 J- r! m. i) c5 Tns_marquee=document.ns_marquee.document.ns_marquee2
}% ^; L& @+ O6 \; mns_marquee.left=marqueewidth+8% c9 y) P0 b, y
ns_marquee.document.write(marqueecontent)5 a2 t9 Z& v% F9 K/ V/ L
ns_marquee.document.close()
2 v9 e1 p7 E/ { } V" M8 vactualwidth=ns_marquee.document.width2 U" l' t6 F3 s4 L- L2 O4 m
}
& {3 L: r2 Z* a. B7 \lefttime=setInterval("scrollmarquee()",20)3 k6 u+ v# A3 h$ r
}0 x) m+ E. x5 k- ^ _
window.onload=populate
4 E# ~2 x o# u) W
6 u0 ?( ?1 Y$ m; Afunction scrollmarquee(){# o; W# O% Q% O
if (iedom){
. [/ D1 U, q( N/ F3 G5 o/ {9 dif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- n3 X2 g+ O! g8 T( e& ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 M& E q6 S9 T( U+ q3 C. }else
3 c) A3 k" `6 a5 ]6 h0 ocross_marquee.style.left=marqueewidth+8
/ N) U/ \: i2 ]$ K- w2 |( k; b" m5 L
}) @ u/ H& Q3 P; Q/ j! P$ W2 T
else if (document.layers){, u$ A4 v K; a6 X( _# B
if (ns_marquee.left>(actualwidth*(-1)+8))
5 ~" G7 ]7 M1 f# _* a. a! Sns_marquee.left-=copyspeed
! \( A1 C9 D+ B' p$ w' N0 ^# c; Uelse [# g" E: q( d
ns_marquee.left=marqueewidth+8+ f$ J" r2 i8 r9 ~7 O/ n3 b# G* J
}, R2 f9 `8 C1 p) d
}
4 G( p( u; L$ S6 w' l
8 ~- g% U+ g1 J" T* ?if (iedom||document.layers){1 u: n9 ^* o+ ~% I
with (document){
p) | A, [: ]# `% qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); A2 p) E- @& s" c0 w* Q- N- l/ |
if (iedom){) j* {* J( D" ?% h4 q! P
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 X+ t; R% S& G5 Y% k$ q) H9 H7 N
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" k- w% ]2 L: \% M$ k
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 E: @2 |2 H9 }/ Xwrite('</div>')
" l7 s/ G- C! ^6 K: A$ p$ A9 L}
( }# V: h: q' K% y selse if (document.layers){# X2 d& @& b2 _6 G# s5 A9 s
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- C) M7 N9 V% [5 @! jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 S q& n# }- n& c' k1 D! ]# B( dwrite('</ilayer>')
' g; W! U- {9 G4 T}, e3 N, z [7 z' e- d
document.write('</td></table>')# m3 {8 }) g' x4 N% ?
}# U& h4 j1 h j
}
, E2 V9 j, i- y' H' F$ |* P</script> |
|