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

|
网页之跑马灯文字特效
//修改宽度
0 q8 Z3 {. @/ Y$ K1 f$ kvar marqueewidth=3005 M, c/ f% i& s" @# ~' d: @! J! }7 p
//高度5 x: r/ X5 C4 h X7 p
var marqueeheight=25
% z2 @% R& s/ o8 y# g |//速度(1-10)
$ M. H" c' T. ?var marqueespeed=3
( s5 v( w% y# v H//背景颜色9 l# E# V7 K1 N0 [ I$ G
var marqueebgcolor="#FFFFFF"
5 C- A( ?: D" U! @. F2 |8 W//是否能暂停 (0=no. 1=yes)?9 k3 |2 v6 j1 n9 o+ o5 k" r4 d9 W; q% a
var pauseit=1; O6 U0 K$ z1 i& \
/ y0 X Y* L3 }. j) A
//修改显示内容3 S, n# ?# K8 A8 u
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
1 ~& t. l: F2 O |
( e6 a: d5 P8 J6 r
: P6 q) D0 J0 c2 ]////下面不需改变////////////; F+ t0 _: @# Z* b( F0 k& }9 f% O3 Q
7 S4 [2 Z$ O) g8 D5 B
var copyspeed=marqueespeed9 u2 m: O7 O6 `3 h
var pausespeed=(pauseit==0)? copyspeed: 07 j5 }. r: H8 y7 H( C6 r
var iedom=document.all||document.getElementById& b# L$ o* P4 g9 i6 @9 m1 T
if (iedom)
# e* ^3 l6 u9 b3 Q% @. hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" b" r6 j# P% a$ C7 Q6 N7 N; I$ q
var actualwidth=''
' L) ~1 s! {/ `9 y9 n$ b( ivar cross_marquee, ns_marquee
. n9 m7 A( o5 w3 O
1 v x$ n. Q3 z/ Cfunction populate(){
4 z6 u' C- f' j1 tif (iedom){ w0 v8 @# p; t8 g
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. m5 a( ^# N# d0 h: l. T
cross_marquee.style.left=marqueewidth+8
4 A/ D+ C5 C7 Z. r3 ocross_marquee.innerHTML=marqueecontent3 m( \+ S* P3 b! u2 x5 P
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; B+ m8 K5 A) x5 G
}
* W! A& K& Z% y. r) Z0 O' ~else if (document.layers){
$ e8 b4 Y: H: k1 L0 X2 x3 R% Ans_marquee=document.ns_marquee.document.ns_marquee2/ t. ]% a( d+ [8 p% R* }
ns_marquee.left=marqueewidth+8
4 h1 t/ {( Y9 |+ Mns_marquee.document.write(marqueecontent)3 K% V4 ^1 e! p C* H. m+ e
ns_marquee.document.close()
4 r3 _# Q+ Q: O9 Y1 }9 Eactualwidth=ns_marquee.document.width
3 @9 \/ L5 w9 a I}
2 ^8 z& d0 b; w B' x9 b+ ilefttime=setInterval("scrollmarquee()",20)
u1 a$ C$ ?1 b$ }* w}
6 ]# K! o6 T/ g @4 Qwindow.onload=populate& z9 T E5 Q& E6 |1 ~& m
# p G/ l# Y9 o M: C/ mfunction scrollmarquee(){" f1 ?( j% ?/ P# R4 M
if (iedom){
+ w% r2 T% a$ y* h6 J- R: }0 dif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); X4 T. O* y" t1 Y
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( f% A* `% Y& u9 Oelse
! o3 ]: y5 p' v* e+ Mcross_marquee.style.left=marqueewidth+8, q4 }6 W: T; Q4 |5 i' p6 h
$ b' [% C, M% J
}
" v" D" w: C! B% W* b5 K( {else if (document.layers){
* P$ i- n+ m& N# rif (ns_marquee.left>(actualwidth*(-1)+8))6 b$ Y ^0 {1 ]+ [" S6 C9 k* q. f
ns_marquee.left-=copyspeed
1 O7 _) v* Z, l6 l* i5 o+ xelse1 z# {6 w7 w- j/ V' `' K, L
ns_marquee.left=marqueewidth+8- M7 n- j5 P5 q" k
}
6 C/ Z1 }, l" l! I. Q: p: Q}
% H5 i+ S1 s1 j% A6 S, p* T) K# ]+ I2 t- Z( g- i2 J9 k9 j8 i
if (iedom||document.layers){
6 i1 F' u7 i9 q( [% v" z0 J, Kwith (document){
8 t U( N, \3 @+ A0 w2 x# ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& W& j9 G* ^; |- x
if (iedom){4 `6 i3 j6 ~) a$ H9 S
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 c1 T3 M4 \; x+ B
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 g( A+ G% p, V# r
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')) m8 n4 i2 }( H8 E8 s5 Q3 S& x
write('</div>')
/ @4 ]3 `; ~5 ^- G7 Q q/ U' T' ]) H% `}: }; p. c1 {% F& i2 O* O
else if (document.layers){. X6 d2 J1 [0 ^7 |# s" n
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& a8 [8 u6 ^# D. E( B
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 H; v: a8 ^. Pwrite('</ilayer>')6 X9 J; r( ~' y
}
7 A: |* {- @4 U- M2 R" [+ ydocument.write('</td></table>')+ \/ x# H: `, O# K5 w! y9 r- e
}
) Z" g* |4 Y3 v& _7 e5 g! \% N}7 t$ }0 J4 v! Y: M
</script> |
|