Board logo

标题: 网页之跑马灯文字特效 [打印本页]

作者: zw2004    时间: 2008-1-21 20:53     标题: 网页之跑马灯文字特效

//修改宽度4 C5 Z3 r8 U$ J" e: n+ c3 o7 ]
var marqueewidth=300$ O% }% ?3 t  A+ L3 x7 Y
//高度
9 f5 C5 U, W* V1 O/ f  C7 x0 dvar marqueeheight=25
& I2 y0 t  x% F//速度(1-10)
* F0 [! ]* q) K4 n8 i( ]  V( gvar marqueespeed=32 Q1 h0 Z, I& O) c8 o7 U4 q' ]4 B
//背景颜色
: n6 R3 E9 G) k' h1 l5 M9 A- N1 Cvar marqueebgcolor="#FFFFFF"
" d8 ~% A. }/ b. ~$ ^! Y# N9 E//是否能暂停 (0=no. 1=yes)?; ~9 n/ n* X/ E$ o' x5 X
var pauseit=15 j: b5 ^: r) ~8 k  l+ V

$ U: {5 E& P3 M$ _* ]3 c* w5 {) }//修改显示内容3 D7 T0 r. N6 k* S& @4 [! t
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') y7 K7 F2 B! K& j4 p

2 G, d9 p2 Z+ ]$ q
/ s3 a, L: o& ]8 P; T- c+ M////下面不需改变////////////
5 ^6 _3 @$ |# U+ [/ x) Z6 X& G
* g' u1 ?7 {, |6 o  V9 d) U6 b/ h( Wvar copyspeed=marqueespeed
7 D; {7 ^9 o* h: _. t* ]var pausespeed=(pauseit==0)? copyspeed: 0' D' n  d. k, m
var iedom=document.all||document.getElementById3 k! I" L. a6 G/ A, ]
if (iedom)
  y& f+ A$ O( Q" Idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( e' Z2 @# Q0 r5 `var actualwidth=''$ z* U8 g, K; e8 G
var cross_marquee, ns_marquee! Z" Z+ [$ R/ D1 s5 e  S

7 W$ k# R3 l! {( nfunction populate(){0 |+ p' d' P% m8 l7 _6 y( m7 p
if (iedom){
- a4 S2 K) O$ Z& P; m* zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: k3 ^3 q( G! H8 x# a2 S" S" @cross_marquee.style.left=marqueewidth+8& U/ c8 e, W9 O0 q+ \) u. r
cross_marquee.innerHTML=marqueecontent0 w0 w* c6 n4 Y) j
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: q- k0 v; v1 E' `- t
}
1 w" t9 s( C4 z; z7 x$ d  x) Oelse if (document.layers){1 M' r" _. Y# h& M7 L7 x9 a
ns_marquee=document.ns_marquee.document.ns_marquee2
+ R5 k' Q. h8 X8 f+ _, _+ I% }4 Jns_marquee.left=marqueewidth+8" j0 C# Z/ ^5 p7 ]
ns_marquee.document.write(marqueecontent)
: X7 p$ n- F2 H2 L7 Kns_marquee.document.close()# t+ P) P" A/ s) ?, h& u$ v4 Z9 V
actualwidth=ns_marquee.document.width# \/ h2 ]0 j+ t' s: Q( \
}. c, t3 Z, H6 f" n
lefttime=setInterval("scrollmarquee()",20)
8 _" U6 u% w2 V; s}
& D. P9 R8 P7 X, E7 z3 q" A! e3 Pwindow.onload=populate- E( N3 C5 @# I' m$ \; Z1 J2 A4 Q
  I) p, V; J7 m- d
function scrollmarquee(){2 z; S7 ^  G  Z" h
if (iedom){
0 P! P& X" X* T' G8 b+ p9 o) Kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 M; P7 a# V) R. p2 F/ I) B+ Ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% K% l6 B( B' J8 I0 P
else4 j0 n# q; g1 a
cross_marquee.style.left=marqueewidth+8
0 P" i% Z7 x, x4 S
6 S3 i4 v; C, _" z$ F# h}4 Q* ?7 R8 L, u$ g; k/ S$ E% V
else if (document.layers){0 ]7 {; b3 T* f  V, ^3 }- [% j" u
if (ns_marquee.left>(actualwidth*(-1)+8))
1 R+ ^/ N, c* c: w( zns_marquee.left-=copyspeed* e4 Q6 e; }1 M- Q' }- O
else& g6 m6 W  u  h( s* a
ns_marquee.left=marqueewidth+8; ~0 t$ h. h5 ]  m
}
5 P( f) Y1 c7 ~  t% z' k3 G1 j1 p# k; `}
, g  b' [' U9 J6 X7 [" ^: w+ |- j, z/ o* y( X8 q5 H
if (iedom||document.layers){. }& z* Y9 T' W7 R4 c0 I
with (document){
* v8 ~5 ]+ z$ M8 H5 P' r$ adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. V' f9 T! k3 T; X$ H- J* O5 n( y+ ~7 Bif (iedom){8 H" B$ u; q9 ]4 y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* }* x. m. I, v- v$ n3 R+ H
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" T/ t( N$ Z% @0 s8 X2 P
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" \& [/ j, h* n& D  Gwrite('</div>')( p. m& y0 Q* @+ }5 i
}
. L. Q: @2 t% @% M  e" ~- i8 Pelse if (document.layers){
2 Y+ ~8 P& K1 w( _% s0 Pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! i  Z& ^+ `. H/ a; Hwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# p" b: d8 ~$ }2 B( g. s( c, Zwrite('</ilayer>')" ]4 d' a: y1 D- l
}
# i* B4 [2 p: h: W8 Ndocument.write('</td></table>')
" L+ k" y4 D! D( O. G- d}6 A: i. }) e) z0 ?& T
}
0 p! C: E' v4 b. |. _</script>




欢迎光临 捌玖网络工作室 (http://89w.org/) Powered by Discuz! 7.2