发新话题
打印

网页之跑马灯文字特效


朋友别哭,要坚定自己的信心,我们一路陪伴您!!!

网页之跑马灯文字特效

//修改宽度
. j6 e2 B* g4 zvar marqueewidth=300) m3 x& [) ]( u$ t5 k
//高度) b: h' z9 Y/ F, ~0 d, J( a
var marqueeheight=25
' H" P1 F9 H& M2 A0 b4 a+ i//速度(1-10)
2 Y& s& x+ n9 I$ n* C  F7 i! W7 }var marqueespeed=3
/ ?! t7 N% ~9 L6 Z' ~. c- e0 d//背景颜色
" j3 I0 l, m7 T7 B. c+ Cvar marqueebgcolor="#FFFFFF"& X* {" b* J0 R# i0 Y6 W
//是否能暂停 (0=no. 1=yes)?
7 I% P% [! R3 ?# v- j; svar pauseit=16 s  |. Z3 {# I* E
; y6 F1 ?6 M3 U) k' H" L) y- n
//修改显示内容
1 C" m- y& L5 jvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 W: v0 x" I: @) {* ~9 J1 q" e) P

' s- F( q2 b2 r0 Z  V5 W+ h( N9 R6 l: E# a. d7 `
////下面不需改变////////////( X- n" a3 ]  D- K

2 {; W" J) u; V+ C) ~% x5 \! E( nvar copyspeed=marqueespeed& f/ u  y! N# `4 K
var pausespeed=(pauseit==0)? copyspeed: 0
2 L! p1 |8 C; O3 U( q( e/ Jvar iedom=document.all||document.getElementById
0 v  k0 i& W: ~; L* ?7 x% u) fif (iedom), r" @' ]; l; {6 S( @: G
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
2 A' X, z# g: }$ b8 Nvar actualwidth=''. n1 y& A; W, o. ~& p3 O8 ~
var cross_marquee, ns_marquee- s" L& Z8 f3 w0 B' S( n7 V% R  q# }, G
+ d0 `% R0 d8 P* D1 ~
function populate(){3 V  S5 o" O- n$ ^/ j/ l3 K
if (iedom){
) p! U& a0 _0 L  m* a/ V7 fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 d' R: Z% y2 A1 J2 Y) ?! [- ecross_marquee.style.left=marqueewidth+8
. y5 H" h( g, ~5 Ucross_marquee.innerHTML=marqueecontent
" m5 w- O, T# Q, I. p2 k7 @" zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
* Z& @4 k; @2 `' E}
& F1 e# U& ]  q: w! jelse if (document.layers){
% n( X' o6 D4 A& x9 \9 Rns_marquee=document.ns_marquee.document.ns_marquee26 m+ ]0 F6 s9 y( L* m$ m) ~; }
ns_marquee.left=marqueewidth+8
- z2 y# d- s2 Sns_marquee.document.write(marqueecontent)
. |0 x! b" |0 W3 r$ b: g2 Zns_marquee.document.close()
0 e+ z2 U9 N$ r6 p- _3 kactualwidth=ns_marquee.document.width
7 `$ u0 g# S3 X5 g2 ?0 S}
, g( n, z% h2 |% Rlefttime=setInterval("scrollmarquee()",20)/ s) X+ g- m9 N
}
0 g/ o! @9 Z6 `2 D0 hwindow.onload=populate. e+ V$ L! N$ V  b- f" b  g

1 M% |8 S# Y) X; S3 Z7 C% M8 K9 Afunction scrollmarquee(){8 y8 Y: e3 N) o& L# ?
if (iedom){
3 n; {5 M( ], z( r, r" vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): f$ N- M$ H- v( N0 e" b
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ ]+ d$ n; l( G0 G# D2 z4 {else
: V' B7 a/ v  t: Scross_marquee.style.left=marqueewidth+83 ~% X9 {$ q( {* n) O$ g0 k

. e4 K1 O2 v8 M}5 ?% [+ ^/ L7 _+ _5 c( i6 \
else if (document.layers){& @$ ]9 z9 U9 `- J4 Y
if (ns_marquee.left>(actualwidth*(-1)+8))
- M, ]4 h6 J. J: K8 ?ns_marquee.left-=copyspeed6 K: K$ C$ j/ C0 Q  J+ K+ I
else
) U3 i' U" u+ ans_marquee.left=marqueewidth+8$ T+ U- g+ v. I! y* G2 h3 p
}; w" \9 F; O0 O1 |
}
& A$ ^7 d! l3 k
) M( W& G! }: A$ y9 V: }3 pif (iedom||document.layers){" ?7 a: I1 E' l8 ?$ J
with (document){+ d: W* N/ P8 n9 M1 U5 P0 m+ R
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')1 q9 l- }( `$ k/ d0 _! S
if (iedom){
- S. b' U4 N4 G" s2 H, N1 g: Kwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' Y$ O7 R; Q" d* {3 w9 l( m' a
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); K6 ~" N- \; K/ @; n) M, I5 \
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" o0 y( j. x4 g! l9 T: B  Zwrite('</div>')
. {, z+ U+ I$ \0 m( U& ~}
" H% N! \' s4 q/ `, J$ q! u2 relse if (document.layers){4 q4 s- Z9 |# H; K$ _- ]
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 Q# L# L4 x2 T. swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; @' x4 P7 `$ J) x( bwrite('</ilayer>')
: t+ |, o3 e: [7 [4 t}
, ]. Q7 a' H- y* f4 j. ^3 z( jdocument.write('</td></table>')
  D" `3 ?1 l; u1 \: ?- z}
0 {) J% X* O* {+ Z}
$ Y9 G: b$ U7 @. b  y1 {</script>

TOP

发新话题