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

|
网页之跑马灯文字特效
//修改宽度4 _0 V$ h' P5 I' B* i( r3 V2 }
var marqueewidth=300
+ o3 H- w- {$ F( B//高度' h, E& B( y( A, d; R
var marqueeheight=25
! I0 K5 Y! `) ?' ^7 _6 I9 O//速度(1-10)
/ n' n: O2 _% J8 t' ]$ o) W% Hvar marqueespeed=3
: @' K8 c# S* [2 S9 M//背景颜色
8 @+ K! R" ~/ xvar marqueebgcolor="#FFFFFF"
$ ~7 y" N( A$ T//是否能暂停 (0=no. 1=yes)?# L# J0 J; r9 c- {) l4 L
var pauseit=1
F: \: t5 i' I0 O7 Z! B( E
% J2 M. I# c+ e" f! M3 g//修改显示内容
+ m4 V& E" c7 _" ^, w% V2 K/ Hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>' p% u1 y3 | R) X7 O# C; l# P
1 x: P# b! E3 J" X- Y
3 w# }9 Z- o$ c! B) ?////下面不需改变////////////
8 a9 h8 C! j& H+ n) d* Q
) A5 {# j# N5 b4 T1 x. j1 q3 f( svar copyspeed=marqueespeed! X! A" m& ~1 Q. ^+ w
var pausespeed=(pauseit==0)? copyspeed: 0; A$ z5 C; V: p* e) o& @6 L
var iedom=document.all||document.getElementById
" S2 o1 w% T6 E' B' B9 p0 n- F* x1 ^if (iedom)
! O$ V) r9 U2 [5 L" z) y' X: wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! s' Q* Y7 U0 ?' F% w: x* q0 s
var actualwidth=''- C# l6 J2 ~. u9 e* b1 ]" E1 ]
var cross_marquee, ns_marquee9 p: h7 m5 Z) V0 Q9 c
4 h* x- H: x, ~; ~
function populate(){
F @9 o) ]" ?$ V" W Z, fif (iedom){; G9 `9 U4 s( Z: ^4 Z2 l2 x
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* T# v5 g4 U- V1 h1 Ocross_marquee.style.left=marqueewidth+8
1 g4 O* q+ R) W9 b, L! ucross_marquee.innerHTML=marqueecontent! `3 l" ?- V+ _/ Z& g9 L1 T
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 q$ D0 [4 F$ _; T! f! M" B} { d" r2 |1 \# t6 T9 S$ G
else if (document.layers){) b4 A M) g7 D) l3 v
ns_marquee=document.ns_marquee.document.ns_marquee2
" y' ^ D( k) `* u ?ns_marquee.left=marqueewidth+8
( M) Q( _2 ]5 s. T1 Q3 ens_marquee.document.write(marqueecontent)8 H( E( N. S6 w* r$ v( U
ns_marquee.document.close()
2 ~& j! p* b# j) ]$ M/ ~actualwidth=ns_marquee.document.width+ N! P7 D0 y% j4 Z: x/ g B, m
}( L0 Y$ G5 c" p" p, K4 f
lefttime=setInterval("scrollmarquee()",20)
- g3 \$ R: l9 v/ m1 T0 j' f}" { v& Z4 P$ D9 a8 p2 f
window.onload=populate
- o9 I2 l/ u1 @* G' v2 f) S3 c* E) H6 G5 T3 E8 A/ w2 r
function scrollmarquee(){9 c( C: _' u4 _% w6 Z
if (iedom){" ] l3 w9 |2 G6 N; t
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 T1 r* G8 H7 v2 m. icross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. f- I5 B! V) m+ w+ z
else
/ F+ z6 \, y5 e$ e0 z2 Dcross_marquee.style.left=marqueewidth+8
% x0 P n, [" Q: z4 v/ ~+ K, V3 V, ~8 [! {1 J" h
}
3 J L% J7 `. E' F; ^0 Oelse if (document.layers){' H C/ b' R2 A$ _$ D& P2 ^
if (ns_marquee.left>(actualwidth*(-1)+8)), V8 }7 A- K( w; a' \
ns_marquee.left-=copyspeed
* Q3 B; B$ t4 X$ {" R- v7 delse
: A( ?7 D# |- Mns_marquee.left=marqueewidth+8
+ V% O3 G+ e9 _2 z}
3 J# t2 [0 y- R5 ^* I- ?8 M}
& f3 d( _' y+ @% k3 J+ X
F0 L3 M1 Q) ]; c* `! R& T5 g Oif (iedom||document.layers){
: ?4 G" h4 Q5 ^, {# Vwith (document){
# }6 Y4 e: ~# ^: J. _5 Ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')$ n! t. d, T2 m: c: P, y
if (iedom){
, J3 H$ j+ n2 O! u3 M& pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): `# A( g" \3 w0 e2 m, u5 f
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* E: v! M4 M, V( E* T# J
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! H0 s2 K& \) K2 P2 Rwrite('</div>')0 k2 ]% i9 ?7 H/ \0 X7 _6 @
}
: c: Z4 G9 V- P( W8 M! Xelse if (document.layers){. F* \* F/ G2 N$ r% m
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 p7 _5 ?& U( a
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
& ^- O& e8 g; B# Rwrite('</ilayer>')
; `6 k C, @0 @* S}
& _) V5 K4 }/ |+ s/ |document.write('</td></table>')
' Q# i {7 x; s4 g4 |2 U0 C( q}
; {8 N+ n3 t5 N" D4 m! Z}
& H* U- \& a; j7 ~. E5 T$ r</script> |
|