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

|
网页之跑马灯文字特效
//修改宽度) t! S- s2 L) ?% y3 `& p
var marqueewidth=3006 B: g! ^" e7 y3 C. b- ^9 S$ I
//高度6 l. b- `# j: A3 L. j- A9 ^
var marqueeheight=253 @8 `( p {9 A) Z g
//速度(1-10)
& ]& @& i/ k( | `* e0 Ovar marqueespeed=3: ]9 V0 \3 V9 t% r% D
//背景颜色$ t3 v$ r; V u S5 Y7 L
var marqueebgcolor="#FFFFFF"
9 P/ P, T; i: |* Q' L) E1 ?//是否能暂停 (0=no. 1=yes)?: ~5 @% C" K7 Q. @, M, S
var pauseit=1- x( m& c; {. c) ]( p, q6 w( p8 j
- h$ u% M+ K5 v, s* G//修改显示内容9 f4 T1 L1 h' `+ T7 ]3 v/ Q
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 M' ^% e- z3 O! a, } P. u+ |+ E6 x* L+ n7 T% ^* s) M
! z+ O9 K& S3 c3 o& s. \1 |
////下面不需改变////////////. _) f: m \- y$ V9 e
( X% j( M3 O& {; `+ T/ ^+ t$ M; y3 svar copyspeed=marqueespeed; ]: V: G& W, e# O& Q |- X
var pausespeed=(pauseit==0)? copyspeed: 0) [3 T5 _1 t( B% G% |7 v u+ ?$ M
var iedom=document.all||document.getElementById+ W& Y# s! }! |# _0 N. f3 E: B
if (iedom)+ R4 z+ t* V% I1 w0 B
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 T, }6 g) e9 c5 Q
var actualwidth=''
$ ~! Z* l# ~1 E5 d/ l0 mvar cross_marquee, ns_marquee
7 h! L6 C7 r: v% G0 d1 ~' M9 g+ m
" w; H5 ?. `. Z8 dfunction populate(){% F' G9 E; q& K( t3 G
if (iedom){/ t+ C# L7 v$ x! x r
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 ^" C9 j- m3 z/ r+ I2 {4 a
cross_marquee.style.left=marqueewidth+8
8 n6 A z; J+ s3 o7 d# @6 e' B( Ccross_marquee.innerHTML=marqueecontent
6 ?- G3 Z( Z7 N# xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: V4 G- ^' ]5 B2 U/ P, i& T% A}# [) s5 b- m) ?+ T* ]$ o
else if (document.layers){
: C3 n0 ^8 m( {' V; H" i% }$ L Pns_marquee=document.ns_marquee.document.ns_marquee2
3 b# N3 z* O" G& L2 i$ f- Ons_marquee.left=marqueewidth+8
* p( I; F8 d2 p- i7 o: [2 Ins_marquee.document.write(marqueecontent)% w( }3 p% `/ i5 H) O+ g( S
ns_marquee.document.close()
6 I$ T% z% u; r+ Y$ lactualwidth=ns_marquee.document.width0 Q. i" g( p; R) ]' @6 f# U# J
}
- d' f; [ \% W flefttime=setInterval("scrollmarquee()",20)1 `) Q. N" B- m' l5 C/ n7 D' E
}
! P: k) b' c e/ Lwindow.onload=populate5 w; h3 q* b2 F! _5 J
7 x, c/ l0 C# r( r
function scrollmarquee(){. }7 ?" ?& g n2 I+ ^( c
if (iedom){1 p" G2 K( c% H n R
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 v; \5 T5 B' W; }% J; ]) L" G9 l
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ M5 o3 \+ p. b: }$ q9 q! q3 uelse9 t( n( v* x6 q2 ^0 y, g
cross_marquee.style.left=marqueewidth+80 t$ G6 U) r: u/ Q5 g5 v2 D- E5 `/ m
) b. W0 C' k0 N+ U}
# B1 ?( Z& m$ z8 delse if (document.layers){/ B; a7 B M- a+ ^( b
if (ns_marquee.left>(actualwidth*(-1)+8))+ f8 I1 p1 z- a% g7 [. ^! i
ns_marquee.left-=copyspeed1 d# d' D- u/ M# R( ^* K
else# [2 O3 Q- f; _$ h4 X) @3 y/ G% g
ns_marquee.left=marqueewidth+8
: o; C" V, ?2 O' X}
8 D$ S! d/ P* o! ^- n2 [}1 w- E7 C& ]- W' T# Y" v# F" o `/ w
- |0 q* E& F/ N6 @1 o: A" w. y0 H) n( Iif (iedom||document.layers){
! o4 l! C+ U0 L+ Y# w- s: Swith (document){: {. O0 Y1 y+ U* e( V* Q, Z( u" w' Y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 x/ x' a, O5 I& F( _2 S; {; Qif (iedom){
`! c: I4 }, P: i7 ?write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' j) b6 S2 s' V0 \/ Qwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" c; `5 k! Z( v& N4 Jwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. h- {6 z0 o; t6 gwrite('</div>'). }. ^) R8 A; H6 r
}6 i+ B4 g4 M# B( [: i+ w
else if (document.layers){
% a, U( A4 o5 Y" }$ [. Dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) I8 P8 o0 ^! {9 ]write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% B. P; k6 E/ F( ]" }7 kwrite('</ilayer>')
8 i, X9 D; S9 k+ S3 _}) M1 O! v/ n; `: l' h
document.write('</td></table>')$ }1 {0 i. z! E* r
}
/ a! h+ I* k4 e" P$ u( }9 F}6 U9 S2 M5 m0 O& B7 D% F% Y4 F
</script> |
|