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

|
网页之跑马灯文字特效
//修改宽度& u1 @" }) @6 R/ L
var marqueewidth=3004 i( P1 r6 g. n$ c
//高度: Y% ~+ K1 }+ `7 t9 \
var marqueeheight=255 d: A4 _% P1 F4 n* ~$ K6 N' A& Y
//速度(1-10)
2 c, E* C; s4 l: q2 P7 Yvar marqueespeed=3
) M- u: a# W7 ~3 k4 T$ h//背景颜色
1 i$ i: |4 M9 w0 o4 _) U2 c dvar marqueebgcolor="#FFFFFF"5 l' r3 B, l- W$ K
//是否能暂停 (0=no. 1=yes)?* n% ~* X% x7 Q+ k" A K! q- C; k
var pauseit=1! p+ e# `+ y9 |9 M5 ]* ]
- q: [+ m. n# v& l' d' u: {
//修改显示内容
; S) h& \+ x8 j# x% z$ Rvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>' g0 }% Y1 j a* C' m* b& v' s! i
7 y$ c: |5 r# E0 w3 T1 ?) M' _" Y1 y2 A# I ]! T
////下面不需改变////////////
1 E) s1 V5 \9 O) \* w. d# o
& q! n% ]* Z+ ?7 i6 q: Wvar copyspeed=marqueespeed
; | e: C+ C% W9 U4 D8 u; Y4 O# Pvar pausespeed=(pauseit==0)? copyspeed: 0
* H' _7 `; |9 J A; Xvar iedom=document.all||document.getElementById
2 t: H) R" _/ I! a0 fif (iedom) X! f9 x- T Z5 r8 x. \# @- G4 `3 D6 U
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'); G5 p3 L, e6 P9 v
var actualwidth=''5 k- W2 q, N8 x9 A
var cross_marquee, ns_marquee
5 P5 o$ {0 z4 g7 k" x4 H- f
! o0 t4 K$ Z" i; I( d1 ^8 J. ]- nfunction populate(){7 V! e; z) i! [ X
if (iedom){
9 J8 T$ e- c- {* E0 Hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( m* [+ p1 V6 l! h7 o
cross_marquee.style.left=marqueewidth+8
. b" c: B0 J F5 ]cross_marquee.innerHTML=marqueecontent m! w% `, {& @; S+ F. k' J
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 ]& R$ [& H8 Y6 s% k1 \* X}- S( q" n$ u/ _, H) s
else if (document.layers){/ E8 U1 _/ W% ^; Z
ns_marquee=document.ns_marquee.document.ns_marquee2% u& X" ?$ o8 O5 C7 u' X7 Z
ns_marquee.left=marqueewidth+86 _1 a/ h# n: P. r# J
ns_marquee.document.write(marqueecontent)
' h* }; x/ N# Zns_marquee.document.close()* b) R/ Z8 K$ ~# e* I6 a5 r8 |
actualwidth=ns_marquee.document.width
% q0 t+ N! U! h, L1 ?7 K}" @0 T: A' i+ F/ ^2 Z: _
lefttime=setInterval("scrollmarquee()",20)
9 B* T ?8 z9 H) r8 r8 b! Q. G}3 H5 e$ o/ g% Q. R1 n' l
window.onload=populate
; O- g* I& M& d. x+ e
* i8 Z1 O! Q/ z4 ^: B$ n# gfunction scrollmarquee(){
! C5 b6 e- E: ]/ {! Yif (iedom){% y L9 R2 _' L, l e
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: x9 }! n- e! @* j! kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- Y( k" w: h2 y4 |3 ^+ J
else
$ C( c" l$ e( s- v1 U }cross_marquee.style.left=marqueewidth+80 A( y+ ~- P* O- h
6 {& x, U6 d1 h/ m8 a}
6 w9 c! ^9 V3 q. [) j; Yelse if (document.layers){; E: c) f, D+ |. t) r: D
if (ns_marquee.left>(actualwidth*(-1)+8))
* s0 v8 D& w% _$ W1 ]ns_marquee.left-=copyspeed- ]: i" ~+ @! j9 E, n+ i+ A0 k; ]
else% ^) s' I3 R! W1 V l9 \
ns_marquee.left=marqueewidth+8
+ L3 T' }% K0 p! T4 |, R7 }* H( t7 X}
7 s$ y: |- ?+ X3 N! C- [6 R}. }) y# Z9 t& J
6 D. @% A) ]" v7 X( y4 O/ M( `/ o
if (iedom||document.layers){. W! {1 X; Z8 i) l
with (document){- I$ ]/ |' ~) u
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 {( J- T: u8 P5 Y4 c6 d
if (iedom){3 E7 E& {% Y, i' N) ^
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">') w- D# j: B6 e Q# ~1 _1 R
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 |) U; b* G5 X ?" ?( r" y
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
# @3 ]$ j% X7 I2 i0 iwrite('</div>'), _' t1 a* Z l+ | V( [, I
}
) v' @7 }( c' Gelse if (document.layers){8 U& Q& F3 U% _( l: x9 ]# B) U
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ S) L/ y4 i% K. fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 \3 |* o2 n. w
write('</ilayer>')
5 ]' c$ U/ {$ n9 r& s& I1 i+ y}* X3 v$ X( g: L; \" ~( r& g3 c
document.write('</td></table>')
9 C1 T1 Y( c$ N$ T0 t}; N, ]* }3 T0 V' _3 Y. h" E' D
}) n+ d3 O; K* T5 o& Y
</script> |
|