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

|
网页之跑马灯文字特效
//修改宽度8 p- {4 g: H+ C: _, c( l o& H
var marqueewidth=300
' X" \- ^/ d9 {4 Q1 x4 B//高度
" e b, A3 c8 Y: J! _ L, T9 Ovar marqueeheight=25
1 }$ a) c8 `7 H: u. ]//速度(1-10)
, u2 U0 ]3 _+ F& uvar marqueespeed=3
! M& T2 P( T: H9 f& G4 T//背景颜色
; ]! L5 M2 k: m! o/ }% Evar marqueebgcolor="#FFFFFF"
) ]8 T9 q, N! h/ O! @//是否能暂停 (0=no. 1=yes)?
% }( p ~) \8 Y: |/ evar pauseit=1
. i8 _. @- u6 u1 S4 t& j/ u
: [& O/ l# y4 Y7 C/ m//修改显示内容+ i( @! f4 b* a% ?
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) v7 ]- Y$ u+ B( \! O8 E+ q$ v
[ C, n" T7 v* g8 y* [' a3 u. g# O8 o4 P Z
////下面不需改变////////////
|: z+ L8 I& v* j7 B3 K/ n
6 i! G! _: l% P8 k* T/ y, t" ?/ ivar copyspeed=marqueespeed
2 N, Q$ H/ L& ?6 O, @. c' t0 lvar pausespeed=(pauseit==0)? copyspeed: 04 J. w8 r7 I# @3 C$ r2 d! q
var iedom=document.all||document.getElementById
0 n, r9 h0 x- v! hif (iedom)
/ _; ?7 s2 q# C g* kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 r8 z& b" u# W+ ^
var actualwidth='', e( Q% z* ?6 a6 s7 J- h& G
var cross_marquee, ns_marquee
8 c) T. {: B* B% K
5 }: O! N( {1 c, ffunction populate(){
% b9 D1 v, L% @$ tif (iedom){& N% h5 m* F7 H, ?. R; k+ g
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 P2 J2 D# E* O! G+ K! W& b
cross_marquee.style.left=marqueewidth+8
% |4 M; `, m9 pcross_marquee.innerHTML=marqueecontent
7 e' Y# J5 ~; c) Pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) ~* _" \7 @0 N, y3 {/ h}
* j& h: X& i L0 w& V, z/ d1 ?' Helse if (document.layers){8 y; m* [5 Z. ^+ \1 S7 I
ns_marquee=document.ns_marquee.document.ns_marquee2+ S* D2 m+ u: [( b) Q- ]0 t# D, P
ns_marquee.left=marqueewidth+8; i1 a0 K4 u4 d# V1 |0 i" R, K6 Z" D
ns_marquee.document.write(marqueecontent)
% y% x5 ` }. _0 t( I$ pns_marquee.document.close()
" z$ d" R1 N: X. {1 v# {actualwidth=ns_marquee.document.width3 R7 H1 d @2 J: C& }
}
& n' r3 _+ Z: r5 g' t! Z$ {$ Z2 dlefttime=setInterval("scrollmarquee()",20)7 U3 U" J$ k- R
} d$ R6 P3 D1 C! G8 [
window.onload=populate+ L/ w- h n8 K1 j' Z/ n% d
. q% i% Y; }$ } J& G2 m7 ufunction scrollmarquee(){
3 O# z( t8 G3 x Bif (iedom){! u% D9 s9 o3 x0 s! \
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* }" _& b# s* J2 X0 {$ `cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! L8 u5 H1 a; @! K
else
+ @4 j( E5 `- r M8 a. ~ C3 icross_marquee.style.left=marqueewidth+8
% _+ z( m3 v6 g' g5 T. l' L: n0 c! p# N
}8 X1 H; U8 Y$ Q
else if (document.layers){; J3 e- @/ A! A5 G4 T
if (ns_marquee.left>(actualwidth*(-1)+8))0 K& e% C' @; \& x
ns_marquee.left-=copyspeed
$ ]+ q1 V Q3 K. o8 Jelse
- R6 Q+ D+ B6 S. Cns_marquee.left=marqueewidth+8
& b: z4 J- E$ v0 G, l}. w; j- E# ^& a9 w9 T( d! L" o4 a
}
! F0 E+ x$ s+ T$ S$ N6 x& Q* P8 E% g0 J" j+ [
if (iedom||document.layers){
0 R/ L: ~% R) l/ M1 L1 l$ Uwith (document){* j0 i' O8 t' _/ C4 u6 ]
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 d. C- r/ Q) Uif (iedom){) ]- _4 _" l, B# q/ ^
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 u4 r( o( x, u4 M: C9 [8 x' k. zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 w. V( @ d& G# G$ [, j z# `write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ t) ~ G: h1 ~: \* C |
write('</div>')% Q1 ~: u- H. s9 F( C
}. L0 L# s0 B7 a) u p& O7 [
else if (document.layers){! w. j8 l4 O- z4 q0 u
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
v$ W7 F6 V* m0 c/ c5 [write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 F% j, H, @, t$ D8 rwrite('</ilayer>')
& O( z7 A( Z$ x) u0 U7 Z}7 _8 y4 t! N. x8 W
document.write('</td></table>'). ]" B6 a( I* \* I
}
8 e$ Y( d# S) ?: z" X0 N}% a* o, b2 H1 q' T1 X
</script> |
|