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

|
网页之跑马灯文字特效
//修改宽度1 S ]8 w$ _/ U$ W( G3 g. M% y
var marqueewidth=300
" K! G! U. W! E1 M8 H) A, L7 }//高度
' ^% Q$ T% \) l( {& n1 I- k! Svar marqueeheight=25 d; K4 m/ b* z# z; X
//速度(1-10)
) A S3 s7 u* E9 \8 o! N# _var marqueespeed=3
& b7 Q8 p1 I8 y; a7 L, A1 r//背景颜色
* z- ?0 ~2 _* ^# R O H, qvar marqueebgcolor="#FFFFFF", z9 c& a7 H y9 q
//是否能暂停 (0=no. 1=yes)?. u9 C' }8 [: o! }
var pauseit=14 y, P0 J! _6 K! b; X* f D( q2 L
; q# \; J; q9 G# ^' E' l
//修改显示内容4 F& K! v8 ~# I
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'$ q5 {" P% a' J+ m* K
i% ~# P/ i( S
1 _ Z" l! x2 J5 z0 l3 K1 H////下面不需改变////////////. M6 C% V/ X. Q( M5 r6 R/ H
5 A, @: K. ^1 Mvar copyspeed=marqueespeed: B: K6 {' e0 a; l' O
var pausespeed=(pauseit==0)? copyspeed: 0
5 R0 g w+ X+ F; a. B/ E2 mvar iedom=document.all||document.getElementById- E2 {; t5 J1 ]7 a: Z$ ~
if (iedom)" e3 v1 U9 H- A7 D3 h
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& u" V- r( G" [7 ^9 Vvar actualwidth=''
4 p6 R& c5 d$ Z( U+ jvar cross_marquee, ns_marquee
1 s$ v5 F9 }$ G6 I- ]( Q0 }7 r' C; D. q. |7 O2 F
function populate(){
) C9 a2 V& M/ f% wif (iedom){
5 p: g2 m% b. e) [cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 p* g" H, x5 o/ }' @; h8 O, @+ p
cross_marquee.style.left=marqueewidth+8
7 z3 Z: M/ ~+ W$ P: p2 Q8 A( xcross_marquee.innerHTML=marqueecontent5 l# C+ K0 P0 p) U5 M- D. m& g/ P
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) J* q7 a+ r0 E' l$ x- m2 H7 B6 [}
% E9 ~$ z2 }" m- {1 Zelse if (document.layers){$ r& D) O5 {6 c& I! ~0 y$ i
ns_marquee=document.ns_marquee.document.ns_marquee2
- j B2 z: j0 b, l& | u! d3 }# Tns_marquee.left=marqueewidth+8- h: Q f* `) a- |* f! _
ns_marquee.document.write(marqueecontent)
l* Z, C. J. Z F4 Y' `7 jns_marquee.document.close()
. G. w( e0 ?: ]actualwidth=ns_marquee.document.width& N" n% I* _) @6 H9 a) e2 E
}8 }' s8 i$ x& ?8 z6 H$ |! H( ]
lefttime=setInterval("scrollmarquee()",20)5 z+ k& P: S3 _& T* L5 l6 `6 i$ ~
}
1 X- z) f/ R& q1 l; Dwindow.onload=populate
! f# J& E; E0 l& C, F, c% T, E, |% S. B- M
function scrollmarquee(){
% f: Q5 |9 n' D* J- ~5 nif (iedom){9 h8 h+ {1 t4 y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* s0 V+ ]) T* Q2 }* G% P5 |* [cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" `' g( X% K9 v) N# k8 ?
else
u9 t+ L/ v& R0 S. ?, X. wcross_marquee.style.left=marqueewidth+85 h7 h' K5 W% X% b# \# W4 z* g
) q2 c g" v6 L
}& x( O5 v- f/ s) T
else if (document.layers){
( S/ ?6 d0 c3 M5 |0 S* rif (ns_marquee.left>(actualwidth*(-1)+8))
f! [& @" ?5 |# n: Zns_marquee.left-=copyspeed
1 X6 L! I$ X8 |else8 x* U% g2 \: W; [0 U
ns_marquee.left=marqueewidth+82 ~- {* T$ D( y8 j8 P0 k
}
0 } G5 [- K4 C) n}( w& H, g, Y6 z' { r. w, F t7 T6 r
X& s! c! Q- h% X: N* M
if (iedom||document.layers){7 [$ `0 ]. v- m
with (document){( O6 {7 p. { ]
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, N% }/ M0 U, `/ v& Iif (iedom){3 i" N( D; ]& o c/ Y, f
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# p: ^# \2 P" }! ?8 D! Y4 l. X
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- H$ [: ?$ Q) e1 K- y2 N! E
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" l7 K Y' f7 w8 dwrite('</div>'). x: Y y8 X5 [2 c+ N0 [
}
) B2 w# s! l4 j! X% v; B5 \else if (document.layers){
) M. ]9 L- m5 S9 Jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ e2 w7 t6 E. J5 H
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* ^# a" r' }* X4 t( F# o
write('</ilayer>')
( ]1 }4 E# p8 N/ @; l}: g! {. H* F% ]) p0 H
document.write('</td></table>')
8 i, y, i1 u; [}5 B1 d+ A4 q1 m, X0 f( \
}' `: b; i$ J( C5 ~: j0 x+ ^
</script> |
|