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

|
网页之跑马灯文字特效
//修改宽度4 C/ t) d( [1 O* l
var marqueewidth=3000 U- U# _3 {7 c
//高度
8 k' A$ U, C) r2 G. l0 ivar marqueeheight=25
& H' p# b# f5 _//速度(1-10)# H8 Z; O j# k2 c
var marqueespeed=36 Q2 F) s7 R0 Y* [4 B0 M. ~7 P
//背景颜色6 Z) _0 G9 k* ~
var marqueebgcolor="#FFFFFF"4 p# Y+ ^7 ?! }* j: G/ Z
//是否能暂停 (0=no. 1=yes)?
5 C4 i" j% X' c, x0 u7 v% Nvar pauseit=16 k( w& ]& }/ X+ t
/ J4 ]% c7 D4 ^: f5 m5 |' a6 E
//修改显示内容
8 z3 v- |- i, n( i$ k; jvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ I y% `. l& \0 W" m- _; Z% s/ L: q6 g" d) v! t: v% {0 _
) X1 v* J7 k0 |- a' ~- n
////下面不需改变////////////
3 _$ {+ ^8 H% s0 v: x+ ^+ z. Z% z9 t' }7 ]8 U1 K- C" ] J
var copyspeed=marqueespeed
1 X- m* K3 I2 \5 Uvar pausespeed=(pauseit==0)? copyspeed: 0, ]5 t' ^, w- B/ t3 M7 D
var iedom=document.all||document.getElementById
1 w# C8 I) q0 sif (iedom)
, m* m1 j' X/ G# N% v9 r! idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; T& J# v! {7 C- k- pvar actualwidth=''
; ]7 m0 D- h) U) ?4 }5 X4 jvar cross_marquee, ns_marquee, w8 }- C5 a" m# Q' X8 T
' t* l7 b: j% A" zfunction populate(){
8 r$ w1 G4 M- h! R2 t. ^5 t7 lif (iedom){5 t# [, U, b; i2 U8 ?6 [% j
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 z0 y: w+ s' f) X# T' x( Qcross_marquee.style.left=marqueewidth+8
, h$ [0 F3 g. G5 z: Jcross_marquee.innerHTML=marqueecontent
# `5 u0 q/ [6 Y1 _actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( p4 x' d9 b8 ^5 }( p3 F
}
( D1 {/ D/ B0 o6 q! t3 q' Xelse if (document.layers){
5 S3 X$ b4 x5 ]ns_marquee=document.ns_marquee.document.ns_marquee2
6 r. q/ |% w4 o% {) V- X& {ns_marquee.left=marqueewidth+81 B4 O: k; M# \9 ~! m( [# ^; Y
ns_marquee.document.write(marqueecontent)
5 T# I/ Y* l* C D, u% M+ Pns_marquee.document.close()
6 Y2 W$ j- s, R: b- x4 H7 e t) Sactualwidth=ns_marquee.document.width
" d+ t9 Y; W8 C& ~! D5 l! ~# G}
. M: \* x* E& X' B7 Z7 r' J7 hlefttime=setInterval("scrollmarquee()",20)1 G$ Y* ?9 S5 x4 l
}
3 h) X. L s s$ ~* K7 K; b- ?7 @0 cwindow.onload=populate
; y) Y1 G. P# t( C) h: N6 P2 |! D8 h8 i# k Y
function scrollmarquee(){6 A) a- C/ `- d7 b
if (iedom){( D9 [5 j: [4 V% y+ N9 z- N/ L
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 D W* U; Y! j3 ^7 P( Mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed, p2 _9 l9 Z& |' W5 a
else3 A% I: F; _. q2 N
cross_marquee.style.left=marqueewidth+8% i; l* M4 P+ ?. I% ?/ u( x2 q
/ ~, O/ F* L# @% p" f8 p
} L0 r, B# V- L6 C1 N* b
else if (document.layers){. }: c1 S, z2 v
if (ns_marquee.left>(actualwidth*(-1)+8))' K! ^" G1 P8 C0 K: M
ns_marquee.left-=copyspeed# j8 ~! H( j$ m; M/ e) X# |
else
! K+ I q1 R" T: }1 r# ]ns_marquee.left=marqueewidth+8
: X" |- {5 V! C+ E1 d& Z) ]}: a% H9 Y5 \$ \. n* T; H
}, O/ I* b! c- J5 v/ A5 a
+ `/ P/ a Z7 V; C/ G: g8 v6 jif (iedom||document.layers){
9 M2 D, w7 g1 H1 `* Bwith (document){0 L# q: r0 d: E9 l4 f$ w) k; d9 K8 s
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( U$ P( C4 Z5 f- x6 ?1 |
if (iedom){
$ w; |! e& o; ?0 |( [write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ N3 p+ e/ E6 b/ K# O7 U Uwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), I$ H9 _1 @: ]) i, N7 O6 k/ N* k
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 n: F6 U$ k. K, o1 B6 C+ b7 q, I! E0 q7 i
write('</div>'). z' d0 V" |& `9 W6 s
}
# [& I. T* N1 S# W: J0 U6 u& jelse if (document.layers){' j$ {3 u5 [, i9 \* o
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), h" Y2 i6 n6 ?% J" }7 m X
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 l& ?: }( `; S5 W+ `) Hwrite('</ilayer>')& i0 a/ j1 k, Y. E; U, M
}$ ]; U) s1 x% c
document.write('</td></table>')
7 ^* s' K9 A4 j1 l! q7 `}0 w% C: ]+ ?3 U4 [1 a" @
}6 a8 l* ?- l/ ?% Y L
</script> |
|