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

|
网页之跑马灯文字特效
//修改宽度
! t# N* m0 K( ~, p6 L2 [var marqueewidth=3002 U' C/ b! D9 b& Q% z7 k
//高度
/ D3 B2 E7 O: k1 }, tvar marqueeheight=25
) C2 j* H* j. _//速度(1-10)* M' {2 A1 ?5 n# I* N8 F
var marqueespeed=3
* g* v( ]$ [! R: }+ Y; J' ^/ e& z+ p//背景颜色
" a2 Y- ]/ C( v. r) j$ `6 }var marqueebgcolor="#FFFFFF"
* e' b- b, g/ z( k9 T5 }//是否能暂停 (0=no. 1=yes)?$ Y8 K4 d. g# ~+ I0 z1 ?
var pauseit=1% t& ], H' e$ G: x
' M: F' H" R( ~$ W( v6 U) u9 V//修改显示内容, q+ x5 b3 r2 d e7 w3 A3 K* x
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" U1 y' {' T+ s* u& E3 e5 K3 |5 r" @, J! W
9 U+ x" ]7 d$ }0 h0 P; Q& V
////下面不需改变////////////- v; g4 G: r' E4 G3 H* g8 ]3 X8 ~! L
, S/ e6 E' g) c# e) t: W; A+ T( B7 m/ _var copyspeed=marqueespeed! G: c- h5 s3 T7 n. g& u( r' C
var pausespeed=(pauseit==0)? copyspeed: 0
( {4 x3 E x+ x. c7 xvar iedom=document.all||document.getElementById3 k5 D9 M8 t( }9 N+ L
if (iedom). Z8 V q) R# C& w! A- G5 r% \" N
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) k2 E& v7 D/ \$ r% t7 K5 v! T) evar actualwidth=''
. b. ~2 P. L6 u7 G- T9 }6 b1 Rvar cross_marquee, ns_marquee
7 S: A$ Q" a; F- K
( ^' C: l# v1 h& k* E& J( h; Y4 [2 mfunction populate(){
. j( d4 J; V# o) X8 _& Kif (iedom){- L4 t7 [2 T. e8 O
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# H) f* ~; z$ F' F9 K3 across_marquee.style.left=marqueewidth+84 a. M2 v) X# O& j! }: Q: i% m1 Z& `; ~
cross_marquee.innerHTML=marqueecontent
2 I0 ]( @( \# ]actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 d6 l# }& m. }2 }$ S7 m& M2 n}: f1 _% v4 R5 Y' {
else if (document.layers){
: F) `/ ?) j/ k+ L& _ns_marquee=document.ns_marquee.document.ns_marquee2+ J0 k0 ]+ N8 f# H! h* I( J7 I
ns_marquee.left=marqueewidth+8 X4 b6 ^, P' d8 ]
ns_marquee.document.write(marqueecontent)2 x- ]2 }$ V- N* _! g( g! H! d& \( C
ns_marquee.document.close()
7 U5 ~2 C1 ?, Q" n0 sactualwidth=ns_marquee.document.width0 k$ \- `4 V; H6 p
}
: }0 K X6 G( l+ N$ e% z/ ?lefttime=setInterval("scrollmarquee()",20)
% u: [1 H1 Q# ?" ?! M}
. B( R% A: y* S& {- o# s8 |6 swindow.onload=populate3 I- P" r) J9 p: l6 F
9 p- d% |5 V) c% c8 P" R) x% ]' Tfunction scrollmarquee(){
3 f2 K6 R$ F5 [% ]! Y5 Vif (iedom){
( h9 Q0 B3 |; Y/ W" y) Uif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 }5 ~& w5 w; x2 Kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 w2 @- A9 c" d# Selse! T" L8 b; H% y; `: y6 L9 ?1 O5 v4 s0 T
cross_marquee.style.left=marqueewidth+81 b7 G: ]7 C9 A! P4 y" J8 A3 U1 L( p( e
1 @$ i. ?+ d* w$ D$ T( ^}$ d; l$ u: C$ z: ]2 N
else if (document.layers){
: T+ L. b8 C1 B+ Nif (ns_marquee.left>(actualwidth*(-1)+8))3 N4 ^/ o: ?& W. @+ j; F& U
ns_marquee.left-=copyspeed
$ W! v- x8 X: C) W6 j9 z' k! |. u8 delse
! {2 H G) S k8 \2 f" zns_marquee.left=marqueewidth+8
. T% {& S; U9 J5 Y. z% W}
2 _9 B) G. K7 L& Z}
5 r1 k( F& ^4 {3 R# i9 C' ?7 l% I! S; {, m1 T7 S8 z2 r
if (iedom||document.layers){
2 {5 U' a1 W4 A7 O! D# \1 |/ B1 ]* owith (document){* h" U$ O! n/ Z) d% T: _' `- o3 F
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 U6 x2 | i0 `0 j& rif (iedom){8 h$ f5 g! o7 |( P( Q5 \( j2 L' G
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 {8 g* z! O6 ~; l- p6 q7 S1 [' d
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 Z# q$ e/ B* F1 }
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& H; Z0 r+ P; T' f' j9 q, J
write('</div>')& c5 ~$ l2 P# l# C
}6 Z; p3 |; t2 x3 @0 M
else if (document.layers){* G9 r) }8 I0 W1 k
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- x- n+ L: |& q8 |
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
4 Z3 Y, v) g6 Y+ H- ^- dwrite('</ilayer>')6 h& {. t( x, \/ l9 l
}
o% m+ R0 u* ldocument.write('</td></table>')
0 e. X# g3 ~$ Y5 \" G}, Z! c! d) t+ x6 p2 T5 `' {% U
}
+ h/ A, g* B% Q X/ H/ J k</script> |
|