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

|
网页之跑马灯文字特效
//修改宽度/ T- Q3 i7 }* K% N! |( A, z
var marqueewidth=3002 v; s7 l4 {' ? _2 ^
//高度: S1 v: @2 t& |7 @4 _+ f8 \
var marqueeheight=254 C2 X8 Y8 m O3 O
//速度(1-10)0 L, e- n: j0 b" ~6 T7 W
var marqueespeed=3, _; T3 }- m* L& ^. F* U+ \" V8 [3 W5 ?
//背景颜色
- Q1 |' H1 q4 c5 L+ u9 qvar marqueebgcolor="#FFFFFF"
" `/ }9 u" s5 E) e: N//是否能暂停 (0=no. 1=yes)?& P' y- n1 m, `: n( b# T; W5 S
var pauseit=13 r) }; w7 D, p( w
5 b( q6 r4 k" u$ |
//修改显示内容
( x- {; e, q# {- Vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
, {0 c: U5 a4 ~' e; G* }3 _: D: ~( Z7 M; G) [* u
7 A# E! y+ Y3 a0 Y
////下面不需改变////////////( Q/ R, |; Q5 [4 l6 S
8 p$ \6 j1 A& U( z; c& _var copyspeed=marqueespeed8 j5 e& z) ?7 o$ U
var pausespeed=(pauseit==0)? copyspeed: 0
# x) Q: ?# s8 ovar iedom=document.all||document.getElementById* p2 [; n0 W8 r' h4 i
if (iedom)
+ @# Q) [2 I2 `) t8 M& D! ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& K! l$ Q: E8 ?6 ]0 D3 nvar actualwidth=''5 g7 w2 S( L. |8 O( E
var cross_marquee, ns_marquee" L/ H7 t$ k2 Q
$ c$ Y+ D2 w4 L# @8 lfunction populate(){
9 |; t) ^6 c9 i M: P# B {if (iedom){5 z1 K6 n* ^+ g3 h
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& J1 W, i$ g) S2 |8 Y) ]9 Zcross_marquee.style.left=marqueewidth+8% O$ R, f+ O1 i
cross_marquee.innerHTML=marqueecontent
# T1 C- M( X, j9 E: | [actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
4 y0 I7 l0 E0 B& N) m}5 M& o3 Q, n. L3 Q# `% Z1 C
else if (document.layers){% q6 q9 k n* H, E' u1 W6 ~
ns_marquee=document.ns_marquee.document.ns_marquee2; O7 P8 R2 f- k. b; i( U
ns_marquee.left=marqueewidth+8
2 `/ H% K0 {( d& E7 fns_marquee.document.write(marqueecontent); |1 t+ p+ o+ M$ X# n) x
ns_marquee.document.close()
- c. t: Y5 {1 `4 O1 Zactualwidth=ns_marquee.document.width
8 ?$ l) m/ R' G- f8 e" d, g}7 j/ O$ ~) U' n& U7 y
lefttime=setInterval("scrollmarquee()",20)# I/ [9 |3 p( X4 ?8 m5 u4 A
}
. B# U! d! H4 V' Lwindow.onload=populate
" H9 f, s4 f: z$ K3 I9 x
+ m' h7 D3 R2 ]0 z2 F6 w' tfunction scrollmarquee(){+ _0 C0 @. O3 @, i
if (iedom){
& Y4 S( |: l0 Q' Eif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ X& z6 e4 x3 H6 x U
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# q" n: y" P( V& f5 ielse7 b) ?. A% ^4 I' \
cross_marquee.style.left=marqueewidth+8
* B3 `# G" F! c( h; ?
! P) T7 J, N2 n( i) _2 \- ], B}; d5 k: r( Q' Y
else if (document.layers){5 ]7 |2 A$ T% `# k: o. j
if (ns_marquee.left>(actualwidth*(-1)+8))' }" |0 i; Q1 f) ^ `" Z
ns_marquee.left-=copyspeed
2 z1 ~4 `, m6 A! helse
" D* J* e% o ]9 @9 }7 cns_marquee.left=marqueewidth+8
2 X$ Z! h2 ?( N6 O' _; L}
7 b" g+ I9 H: `; v5 N}
, `/ u5 u9 X; f2 m0 [" [: R
2 A# u$ [0 z2 g& Hif (iedom||document.layers){0 o' ]8 O3 d/ `/ [+ [4 d
with (document){* X4 ^; L# e4 w$ {6 U" P
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 z; ^; X( z0 h) i- w9 _4 Iif (iedom){
s# x L( R$ w, ?. ^2 o jwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ d' S# A Q, e+ B0 I' `0 |6 I0 @
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# K9 |1 V; f2 l" j# lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 |" o1 E3 y" F6 j- B3 O
write('</div>')
6 Y- d. w: n1 i# H- R! ?: E}& B: O4 E5 Y+ j: a% H/ m
else if (document.layers){
9 Z) G3 S, a- B( uwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>') i. S3 |; b8 K4 L; [
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 C0 D ~2 X3 Z7 Z# Swrite('</ilayer>')
$ L0 ]6 r: s8 _( A* z' i: F}% ~; i1 D( h/ ?5 w& m! y; W# V
document.write('</td></table>')3 ~% X: T* h b+ ]7 A! R( E
}
& E- l& n; D; P/ S; ?; r% |}
! n" v1 D- g, A6 H% w' @5 D3 _</script> |
|