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

|
网页之跑马灯文字特效
//修改宽度1 o/ l7 F; ]( i7 ?7 H1 X( C
var marqueewidth=300
" Q( o1 ^, ?7 h+ H7 B. }' V4 S//高度
- l: J x4 J. G7 p4 R9 k( C4 Wvar marqueeheight=25
* [0 N' \; D3 M) n, d3 f, \//速度(1-10)
4 I( t: `7 b* Nvar marqueespeed=3
9 P5 x+ m' A5 u3 L//背景颜色; d" L! O3 E+ O# B
var marqueebgcolor="#FFFFFF"1 n0 C3 ]" f$ y0 g/ l* S( o
//是否能暂停 (0=no. 1=yes)?" | x$ p) O( ~% S- h
var pauseit=1, @& g% d: g$ I9 T' o' Z
# h/ Y& K% A6 w% ~! M
//修改显示内容7 Q! u8 z% \. ` f
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% e0 W( E% W4 a' v3 D& s
! t& A! F8 g1 \& h* B) T
" s! e, E7 N' N$ \2 x////下面不需改变////////////0 P- M, H2 ^/ H. J/ W
* d, ^( m" d" N, B! \
var copyspeed=marqueespeed
" h) S, k, M3 T w4 n" xvar pausespeed=(pauseit==0)? copyspeed: 0% M) C" c+ J! C6 c) Z
var iedom=document.all||document.getElementById
. L2 D7 G) U% e9 @if (iedom)
/ H. b( f( g) \7 z. T9 z7 V: |document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. n/ G, D6 o& I; x/ F3 j9 mvar actualwidth=''- j1 W; V% a7 L6 c
var cross_marquee, ns_marquee
8 k5 _1 I% L" N! c4 ]( f( U
: M* {3 y3 G5 F2 K' k8 Jfunction populate(){+ ^' Q% E6 a! X+ T9 M# _
if (iedom){0 k9 x: c' I: @' p+ J a* I8 m1 ~
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 B% Y. W4 Z; \% mcross_marquee.style.left=marqueewidth+8
! K5 D$ ?7 b3 U6 Scross_marquee.innerHTML=marqueecontent
p, d6 s* q: x; V; G) gactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
* C n2 _0 c" K/ G8 P7 f}* C# N9 r; l% u( @; j( q' R. V3 A2 K
else if (document.layers){. K0 {! C" M2 R+ ?6 T' f. Q
ns_marquee=document.ns_marquee.document.ns_marquee2
1 H, V2 x0 T M: u. R. h0 k* L4 uns_marquee.left=marqueewidth+8* ] f7 H6 J* `8 d
ns_marquee.document.write(marqueecontent)1 U0 T! `% g' _2 m" f
ns_marquee.document.close()
) X( t- B* \) B2 R; |7 M: J2 L( |actualwidth=ns_marquee.document.width. n5 ]0 ?' F) l
}
6 _ [ o2 A x. glefttime=setInterval("scrollmarquee()",20)/ [7 U! @! R5 u: O
}
( @9 z# X0 J9 M1 I& g% X; n0 H& mwindow.onload=populate: B* m8 L& n E& N5 G9 `* C
1 U# @/ u0 m1 }. k' _function scrollmarquee(){
* D, g8 [' H+ z" O( ?5 V; N7 aif (iedom){
5 S& h7 i" G7 s' cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 W: [+ A) k6 M
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 C2 C! O+ M9 p9 r& belse+ u4 Q( s. h' S7 J" H) z6 } I5 G
cross_marquee.style.left=marqueewidth+88 l2 W n; o. {, ~: A! B
7 ^2 j, q7 d$ {, R}
# }) w: c L) l2 Felse if (document.layers){, \$ q, `0 Q3 T2 j/ O/ L
if (ns_marquee.left>(actualwidth*(-1)+8))
6 [* s" `4 n8 v! R5 _; M7 t/ s7 Wns_marquee.left-=copyspeed% I, F0 O: A( c& L% I; t
else H" w$ ? H5 `, y! Q2 Y
ns_marquee.left=marqueewidth+8( e1 i4 [, G# W9 @! E4 W( d! |3 o9 Q
}5 ^9 O s6 S2 @% x' d, w2 I
}# y/ }. J0 T0 }# v# R' q" y2 B, x7 u
% C0 i( d3 M6 q- f$ }" Jif (iedom||document.layers){! e7 j* F, O" n8 F# {; a: w! B
with (document){
' `5 ]& z! w! |5 q: ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 g* I- |3 l+ m# S/ l+ Q& Z! ]
if (iedom){ C4 d# y( U8 l* z4 n# h
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" T2 H5 `7 M1 d7 m) z8 Swrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( ?" \2 v! z; b& iwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 o5 T; O( P5 X7 P, U4 W. f( K, Awrite('</div>')
# |7 }0 w% r8 F% U& K I8 T9 W}' J5 ~2 T- L, y+ q1 c. Z
else if (document.layers){0 c0 s5 X& H7 ?* |: q8 l# W3 e; ~$ ]
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& h$ G' {1 u7 T( O `7 {% @write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). X5 P+ e7 F) r+ B5 [6 w( t
write('</ilayer>')
# b7 `4 X* U. }3 `2 x7 o* k, @}3 p/ w' q8 x3 B+ n8 K
document.write('</td></table>')1 Z/ y) L) p: x& T t j. O3 [2 T
}
) h4 v" u/ r2 t, Q( l}+ O3 r* u* J+ \5 R! H+ a- i
</script> |
|