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

|
网页之跑马灯文字特效
//修改宽度
. L+ w, ]( R4 z' |+ Z4 s' d& Hvar marqueewidth=300; w* Y/ a/ S5 C' B
//高度9 r$ D4 y3 n ], V7 s3 ^! E
var marqueeheight=251 p# ]- Y3 L1 i; e5 r K" r$ p. r2 W
//速度(1-10)
( h( d/ K; l7 u# M5 @var marqueespeed=3
8 [% B6 b6 ?8 Q. l0 u4 o4 x//背景颜色
$ {+ E6 b Q2 o" ?4 Rvar marqueebgcolor="#FFFFFF": v7 B: r( m% W6 p
//是否能暂停 (0=no. 1=yes)?
0 Y G8 E9 U7 R* u g: n! Dvar pauseit=1
6 ]: f! r+ I$ B! T7 O, S4 o/ U, K6 O5 ^: L6 g2 l
//修改显示内容
# }$ X' {# d: [* i% K0 nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 l& x) N3 a5 ~0 \' x5 s5 ~4 _/ i. g; v& _, S0 \ H/ H
: a/ T; A* Z7 {2 q////下面不需改变////////////
: G0 j, |, m2 ?- l7 {4 ?7 K4 K9 h" T
5 [" L4 `4 R4 l. rvar copyspeed=marqueespeed
" x1 v* S( ], n" Gvar pausespeed=(pauseit==0)? copyspeed: 02 p: m1 a6 p' H5 P; }
var iedom=document.all||document.getElementById9 M1 W) j. c1 ^2 |, H5 N
if (iedom)
& J0 y9 { E# Kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')- i# d' ?. E+ R7 o
var actualwidth=''
5 o$ P2 Q9 L) q6 X- T2 Gvar cross_marquee, ns_marquee
8 T0 Z0 a6 a2 U \/ y |, @, z4 Y: [' t. W8 t- C4 ~. o( Z, T& B
function populate(){8 @: }# v; v( T0 q6 W
if (iedom){+ P5 H' [, _. @; `4 P8 i0 H& B, o
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee) z- I. b8 s" ~7 ]0 x; U; d# e
cross_marquee.style.left=marqueewidth+8
2 S# J, ~1 R: ?3 m" o$ z% {* ccross_marquee.innerHTML=marqueecontent
7 `/ n% s' q5 [8 Jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% W1 Q! Z; R& O4 n}% o# _5 i f: O
else if (document.layers){4 g; F i+ S4 V' D
ns_marquee=document.ns_marquee.document.ns_marquee2
; K0 P" `6 y$ x1 Vns_marquee.left=marqueewidth+8
9 t6 y0 J7 K4 B' X ]9 |) \ns_marquee.document.write(marqueecontent)
3 G7 n( x* r7 b# B8 cns_marquee.document.close()/ g, F5 I* n/ j$ P* Z9 s4 L7 w. b
actualwidth=ns_marquee.document.width" b+ x3 N$ h/ T
}* S+ E( B' }* @- v: B3 C
lefttime=setInterval("scrollmarquee()",20)
' T* Z! u0 c1 O2 n& k}
6 C4 f1 ~8 b! P% b+ Zwindow.onload=populate
, j3 X& b2 u9 O6 C$ J7 s5 w1 e4 t8 G) P
function scrollmarquee(){9 v% d) b5 v2 r! `& {( W! }
if (iedom){; L* Y2 j4 X, x9 \ }2 a
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 N" H% k8 a3 k$ H
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 M( h7 g# L2 O# w3 i6 I9 W
else+ ~& w' i; o' G3 L: v( ^& Q1 O
cross_marquee.style.left=marqueewidth+8& d( G7 O+ m& ?
8 l6 ^: I g5 r! F}( d9 Q5 Y+ i3 c+ T" x/ W
else if (document.layers){
( d4 Y9 A2 D j) A# Cif (ns_marquee.left>(actualwidth*(-1)+8))
& i1 S- q7 m; R0 ens_marquee.left-=copyspeed
7 T5 z; Z; z( E& ?- U% Gelse
u; O3 K+ T3 x5 n) ]% [ns_marquee.left=marqueewidth+8
3 h. `! {9 G1 o$ l' \# j* Z. s}
4 @4 u! `) {4 i, M( a5 M- V}$ s2 D9 n+ b2 D
1 C6 T4 h9 E$ ~if (iedom||document.layers){/ T$ B% x3 n5 t# v
with (document){
. z5 u; h! K z$ F2 J @& A! fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; P" s/ x) T- u+ U- nif (iedom){0 K' s' Q" V- K! \( ~3 s! o* q
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 r0 C7 t4 w9 |5 Q6 l
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! ?" C) U N5 T$ X' Dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% t4 T- N% }0 x4 V% W3 v' Z* ^' P9 iwrite('</div>')
r; a3 [0 z0 X* X! k}
$ ]+ C# _' ]3 A0 G. Z/ }( z) t7 aelse if (document.layers){
. e! H, L% h1 N0 S( {6 ^! Q! Kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) a4 V8 I% u/ b% Iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 @# Z8 G/ d5 D Q- P' _
write('</ilayer>')
0 J( H+ p% s$ f+ j3 T5 {, O}8 u1 u6 I6 S9 c; i" c T
document.write('</td></table>')
9 @3 Y' M0 J9 |4 m$ }7 r: I}" o' l j& I3 a {* j- [$ N4 Q
}
3 D; h+ [) Z+ U% L* `0 F! _& w) y</script> |
|