返回列表 发帖

网页之跑马灯文字特效

//修改宽度. A! `" u) z  P6 x% O/ l
var marqueewidth=3002 P$ q0 O3 h% y; b4 I$ p3 R$ e
//高度6 }* m( I: G+ w: A% E% ?
var marqueeheight=25
7 k/ C9 a; \8 _//速度(1-10)3 d2 X1 o$ v) ], ?
var marqueespeed=36 m) r- J( z. y( v  v
//背景颜色
7 o( U: z: j8 Y3 s2 t! I) q( G( Cvar marqueebgcolor="#FFFFFF"  S6 M( c. M& y$ ?+ E
//是否能暂停 (0=no. 1=yes)?
: o. l+ u, m5 M- l* @* O7 ~# Pvar pauseit=1! ~; J, j4 u8 f# T
( S, C3 p! A: b& M4 F1 K% j
//修改显示内容
. s( h8 d8 L, U- N* Mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& V  X& K% T) H6 a) B* L- L

  B- C7 N/ D0 B, j+ b3 `- n3 y  H( Q# n- M+ o6 J
////下面不需改变////////////
9 p( h. Z/ n: ^3 ~4 q1 G2 b/ r+ C" j7 e- _( Y
var copyspeed=marqueespeed
0 q1 n& Z% Y. lvar pausespeed=(pauseit==0)? copyspeed: 0
; u& I$ Q& f; ]% A, g9 M! ~var iedom=document.all||document.getElementById' W9 ]1 j) v+ A; |0 Y
if (iedom)
+ U& R  V7 o0 S0 C& w/ Idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ T& U* r9 T0 ]* u
var actualwidth=''
, u2 ~; O' Z  ~6 D4 Rvar cross_marquee, ns_marquee
4 Z. R# v9 {# M( A
( j1 R) u* s" U9 |0 Jfunction populate(){
1 q/ A6 R* e2 |. b" L4 Xif (iedom){
* }. H' ?( u. Q& b/ qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
" i' D# W: q5 T/ i, w1 ~6 g7 t5 q% Across_marquee.style.left=marqueewidth+8( a+ d) K3 q4 k% f" g
cross_marquee.innerHTML=marqueecontent
! O  D) G9 z5 f% V% {) vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 C/ Z2 x! @9 X, l5 n; B
}
& a0 J$ e- G% A! O* y9 Q# Gelse if (document.layers){7 B: `, D# }3 F* y
ns_marquee=document.ns_marquee.document.ns_marquee2
. P; K- a, V$ D* O% u* g8 ]0 a$ jns_marquee.left=marqueewidth+80 f% u1 I0 I% A1 [* d; g0 f
ns_marquee.document.write(marqueecontent)
$ P$ v4 o% G; C* sns_marquee.document.close()# O; T  c* H- F. r8 Y1 ^( ]3 Z* N
actualwidth=ns_marquee.document.width
  I2 _: Z: F3 F1 V( r}
2 x! z, z) f5 e9 M1 H, R! r; ulefttime=setInterval("scrollmarquee()",20)7 A! o6 d5 ^/ N( F7 [
}
8 v. M: R: P; c7 \" wwindow.onload=populate# [9 z! y, s6 |/ ?0 Q3 r  w4 \) E

, G& Q( J. B0 y& b( dfunction scrollmarquee(){" e* ?4 J7 U' ^6 u, w/ w3 H" F
if (iedom){; s1 F* \5 f. U3 r/ Y! l& g3 R
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: _6 D- b4 `( C- f& A. [! n# m. h" Y) Jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 k" M4 e5 a  p! ^2 Z# F% U3 M' n# y
else
. H7 Q# {5 c0 @- tcross_marquee.style.left=marqueewidth+8
* F' M2 ^+ n- w% k7 ~. Z! }  ?& v$ C/ P' O8 v. f
}
# Q3 a# y3 v+ D7 o- Lelse if (document.layers){
2 T0 y+ ~  z  _5 \1 h' Hif (ns_marquee.left>(actualwidth*(-1)+8))
- [" r+ z0 Y! b# b# U5 vns_marquee.left-=copyspeed# x' q( d0 g5 R+ L! f
else
( I0 T+ v. m6 `ns_marquee.left=marqueewidth+8
4 n8 l; s# w& C! Z/ E- J}) [. z) l6 w  L) T$ p
}; w: F6 D. |! p3 D* L" g
. V+ B4 v* ?) L4 r) V* {
if (iedom||document.layers){
7 }" ^; d8 ~( `) Z$ wwith (document){2 W; x+ [/ M/ M, P
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! `7 Y1 f2 D2 ^8 F5 @3 Z' m4 z. Sif (iedom){1 e  [# G" Z2 ~. J9 V, z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" H( p; h2 b$ ~$ W0 r" |, b- E
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' T2 P5 R6 H4 j$ ~  ], j6 Q, d9 n, a" I: M
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* X& G3 _5 n9 r) _" q
write('</div>')$ t( I4 H3 W- l) x* {6 ?( l) }* I
}
& `$ o9 l& s' |1 }: r& helse if (document.layers){3 z2 v# D5 W1 n# C& d
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')  n! y1 H! t- \: x7 [; X* g
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ |/ Q% r2 R. F7 O, S% H, ywrite('</ilayer>')
! b% P* C; T8 \' Q$ Q0 ?1 Q- p5 v}
1 n4 h! B. y0 [( zdocument.write('</td></table>'); x$ U9 @0 g, ~& |2 `
}
/ I4 k3 h$ p; Z! X5 [" k: I1 d}
6 T4 N3 r6 a; p- K5 v/ [; \</script>

返回列表
【捌玖网络】已经运行: