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

|
网页之跑马灯文字特效
//修改宽度
& v5 h, a: u& g2 Cvar marqueewidth=300. ?' D" @1 L+ i; k. @
//高度
& R+ ?4 }/ p+ t8 f8 p, zvar marqueeheight=25" I; V* |6 m1 F
//速度(1-10)" c, D5 B2 [6 b' {% {
var marqueespeed=3( d5 d4 X( m* b- h. p( @. m% h! W
//背景颜色/ i! X* g5 [7 G- u4 @. W6 M& m/ b
var marqueebgcolor="#FFFFFF"4 b4 k6 J* u X$ t6 D# b
//是否能暂停 (0=no. 1=yes)?
+ u5 L$ U2 N4 vvar pauseit=1
+ D9 m9 C9 m+ B2 L8 f
4 y6 `6 i. x U' U; q//修改显示内容8 v( j+ g( ^; E5 n4 O
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& @* h0 x' |0 d# b4 ^+ e
I3 u% q& w& r, D7 p. b2 Q: c1 C4 C8 Q, _8 F7 C0 q/ q
////下面不需改变////////////6 D6 x. x% M- o
9 J: b/ U1 u+ k) ^; kvar copyspeed=marqueespeed
% Z2 S( O& i2 a: Hvar pausespeed=(pauseit==0)? copyspeed: 0- J& g2 W7 L9 o# r6 j; q+ z
var iedom=document.all||document.getElementById
- b m+ E% f- \ X2 Nif (iedom)3 W( C1 c, B! Q5 A' X
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 N. q J* k4 G& `* I9 jvar actualwidth=''
5 X! g3 F8 X7 ]2 H9 i% p7 G1 k4 Jvar cross_marquee, ns_marquee
( L" j8 S: k6 h4 v$ H/ {4 W# x: E& q2 o
function populate(){
% F4 w# Z k( ~ ?: I sif (iedom){1 t' t2 C7 Q$ M( m) l' u! O2 x) X
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 B4 i& k, g8 ~$ A: T0 ~! o L$ ocross_marquee.style.left=marqueewidth+8" F" f: }( P8 K) k4 V* X
cross_marquee.innerHTML=marqueecontent) B# A) u+ ]0 \; l" F) L2 Y3 F5 ?
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" G/ W& Z1 f+ `8 J* B. G5 G/ N
} R9 [( E- L! G1 m! n$ O
else if (document.layers){
5 H1 f M& x8 M! ^% E) b5 O! K' \ns_marquee=document.ns_marquee.document.ns_marquee2
& f$ ]2 c* C, ^/ `$ \( ?7 _ns_marquee.left=marqueewidth+8% z0 v. |& o2 ?6 v7 b6 I
ns_marquee.document.write(marqueecontent)0 x$ \3 d7 _9 c* ?5 S
ns_marquee.document.close()) v w7 U; q! T, {) i3 e
actualwidth=ns_marquee.document.width+ n4 m" m2 ?' N% T2 Q8 `$ M& ]
}
* ^( L# n E5 ^# [! Q& E7 o [lefttime=setInterval("scrollmarquee()",20)
, g! [7 F9 F* h}0 f8 r6 @9 T2 P- u
window.onload=populate
8 { s& X9 e7 I
+ _1 u+ b7 Q* g- Z2 G0 J: I1 y+ Dfunction scrollmarquee(){: J' y. K0 E K( r' ~ b
if (iedom){; ? k) m6 y9 z% _' k1 b- R
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' b* p2 W, G% {0 r3 ^# mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ v* b0 e5 U/ ~
else; f$ ] p9 j% }& F) @
cross_marquee.style.left=marqueewidth+8( C% u2 C j8 Z3 P2 h/ Z* i& n( W$ e: Y
2 w0 S3 S# \6 Z( h2 G) v: A9 q$ M
}
# L% x3 }2 v; p o6 welse if (document.layers){
$ p9 O0 U+ q( {/ f. `& Zif (ns_marquee.left>(actualwidth*(-1)+8))
8 z3 _ Z- T8 S2 q( S3 {8 vns_marquee.left-=copyspeed
+ _) q$ V" ?. Nelse) ?" X4 `9 Y1 c% k$ P ~% @
ns_marquee.left=marqueewidth+8# w2 i, v( X+ K
}/ C& {! ~# P9 n: Q
}
& C( Q, p0 d1 ~! j h H* T' z- ]7 g6 w- L" y" O5 d
if (iedom||document.layers){& ^( ~- x* x7 k- ~# O
with (document){
" ~* L' {' _7 vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- H, k7 Y7 x' R9 ?1 q' P8 ]
if (iedom){- p& @$ }/ n% K) S1 ^! f$ x
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( J9 ~* f; Q7 N1 w8 L9 Dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# K$ m; c0 P+ v7 f: m) x1 k
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! Q& G6 p* G/ {: E2 n
write('</div>') K% u6 u& X0 t' l P O2 n
}
1 J' e, \7 v9 x5 r p) t, H+ zelse if (document.layers){0 F a! E R& Z5 I
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- R$ `1 S5 S. B/ U5 J8 L2 ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); F z' D$ T) k+ ~9 B
write('</ilayer>'): P8 L7 }; b3 J: Y- A& y0 D
}
: }8 ]) i* f; M, wdocument.write('</td></table>')
4 [+ \& ~, U( b* M}
! R7 d, r6 z# {8 M3 m}% c3 L( f: a1 T# h( h C" I4 _1 ?
</script> |
|