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

|
网页之跑马灯文字特效
//修改宽度
! z$ A y9 F, xvar marqueewidth=300: T: N: J# I4 Z3 d8 o
//高度: O7 Q6 f; g- O1 ]; }! z. j
var marqueeheight=25
) y1 V6 z9 U7 I. @1 ]//速度(1-10)$ P2 {5 ^% z* k! @/ P0 [
var marqueespeed=36 v5 b0 u/ d0 Z# d8 @8 P' ~1 S
//背景颜色
0 h# n# E" p5 }. F, nvar marqueebgcolor="#FFFFFF"7 n8 i1 L' l" L$ A2 F
//是否能暂停 (0=no. 1=yes)?
# W: H& P3 Z( evar pauseit=1' t9 b: o: c- R i
7 u3 h; b! t$ G
//修改显示内容
{' q+ A7 H& ~! ^; `8 ~var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': R0 y* l5 L: Z% P3 ~, v
6 ]+ o) h6 t* F) n: V& @! d
5 e) T \7 z4 s: m+ n" ^* ~////下面不需改变////////////& D4 N, x: S1 @' i" L2 ^4 p
" ~" q& q6 z% m) J8 P n M6 w* Hvar copyspeed=marqueespeed
$ t0 a3 Y) r- e3 B. gvar pausespeed=(pauseit==0)? copyspeed: 0
q; H# x" u6 A- p6 s8 i- wvar iedom=document.all||document.getElementById
2 Q W) J/ Z2 C1 Qif (iedom)4 A( _$ b7 c D; a9 ~9 F, H
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# B/ I8 M# b9 ?! m: ]! q7 Y0 J4 C5 Gvar actualwidth=''
# b3 ?% \+ ]$ F9 P. I2 ~* u; vvar cross_marquee, ns_marquee" T& s- z8 P8 u2 j/ N
4 t) D& y- j/ ]9 J& i5 N: y6 G
function populate(){/ C9 D( ]! r# w5 a# p
if (iedom){3 p9 `% G" X7 }5 y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) J9 { u4 |# e }- n. ~ G, G, Ucross_marquee.style.left=marqueewidth+8# K! J5 X4 X2 \) G; q @1 E
cross_marquee.innerHTML=marqueecontent
+ G3 D( o1 T+ S' }4 j' t6 ^3 Lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) }2 a0 w+ ^& ?6 i/ C# m}. Z, ~! K: W9 V e
else if (document.layers){
1 m/ Z p. J% V2 yns_marquee=document.ns_marquee.document.ns_marquee2
1 L2 F( G7 i3 [7 q8 bns_marquee.left=marqueewidth+80 h+ L. h8 N5 S; D4 {
ns_marquee.document.write(marqueecontent). t, X2 I: D( a, m n% U
ns_marquee.document.close()
5 V! T- O9 c3 c/ @actualwidth=ns_marquee.document.width
- \1 Q5 d1 R- b1 C}
- X* h) u& r v `* _( ~lefttime=setInterval("scrollmarquee()",20)
9 i8 V4 W0 K1 ^1 N$ Z, I5 Y}
$ @4 p+ l$ S# f& S; x- Pwindow.onload=populate
/ }7 `% V6 A3 p8 K% e0 i: i- H0 F; M) @9 x' z8 Q4 p s
function scrollmarquee(){
# \% v& @$ O7 [5 B e" q4 |" m: cif (iedom){
" e) M. W) _9 N; ?" R' s' uif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
7 c0 D5 p6 V( Y1 C" kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 z; c) X: d" R8 R' T( k2 melse
6 }3 F X! D. e R' ?6 d7 qcross_marquee.style.left=marqueewidth+8
! e) h7 K( \& t+ v% ~5 T6 s
0 N0 ~- A3 f! V0 t8 i7 j8 i}, p( |% z) Y- v" D, G6 m1 w
else if (document.layers){* a% l6 G7 s5 o4 q( `' X
if (ns_marquee.left>(actualwidth*(-1)+8)), t8 E8 ?8 L3 T" ], `4 E' a
ns_marquee.left-=copyspeed
" A2 \: l- V* l6 \. yelse. @: B K; h; t2 A# f
ns_marquee.left=marqueewidth+84 _2 @# q4 \ _+ Y B8 ? K: V9 N
}
$ a9 O: W. a" V}$ A( X; B4 ?6 l) T+ e+ F
s' q% }6 t9 d8 P, Zif (iedom||document.layers){% [: \" w9 S% w: p, l0 J' E
with (document){ q4 C4 |. i1 u* U
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')$ S# ]0 U2 u2 u( N) [! v$ r& w( p
if (iedom){
0 o3 M0 J4 L& W0 B0 nwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) e' V/ t) j: u4 C, |write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
0 l) |5 b2 f" d/ Pwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 ?- o$ S( ^' @" d3 {! jwrite('</div>')
- R7 @, Q1 X5 g' e1 B( S9 t9 o}
! I' s( w8 ]+ Yelse if (document.layers){& y/ M t6 [( K8 ?
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& t6 W2 n% t& Jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 c5 Y: g" p; P" L# g4 p! P9 Dwrite('</ilayer>')" H9 K- u; ~* F: x
}1 C, |) Y) Q, r! |! i9 r5 u( p
document.write('</td></table>')
. v# w" K( o6 D6 O' B# @9 w}& o2 f, C7 q5 u
}) c# ] }" l0 ^3 G% ^ U5 J4 h, N
</script> |
|