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

|
网页之跑马灯文字特效
//修改宽度- E+ w+ Q' j5 T
var marqueewidth=300
$ q0 z! x; n% C' Z e//高度
( I. L) M7 @ E$ E3 Wvar marqueeheight=25
' @* C! ]. |" r# e4 O//速度(1-10); \2 ^- F$ Y! `4 m- J! P9 D
var marqueespeed=3) X2 ^% @% \: B' D6 ]& i8 X0 R
//背景颜色
+ U" K" i; V% B# Z+ c# a$ Dvar marqueebgcolor="#FFFFFF"
2 J$ s8 B8 X9 l) s" h//是否能暂停 (0=no. 1=yes)?- U0 _% A5 i# ]7 F" h& w9 h
var pauseit=1
' f, k2 S# V6 @' M; ~% K( _; s* W& s6 d0 e
//修改显示内容 U) J Q* F3 \ d& |% o
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; ^2 _6 A. ~" ^) o* b# a- { p' g
6 s9 L7 U$ T8 c& G5 W2 q% S
7 c9 i# u5 r8 T, V. n////下面不需改变////////////8 P C: ~" L* D
9 u1 \# ~% t1 p/ X, G2 S
var copyspeed=marqueespeed
6 L% ?" y) B6 `9 M/ B: b# dvar pausespeed=(pauseit==0)? copyspeed: 0: M9 q6 L7 k) C
var iedom=document.all||document.getElementById+ P9 V) @" ^( Y% P% K
if (iedom)! J7 z* X2 D: `: C
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, ^7 m0 }# _ L: S2 J% Mvar actualwidth=''
: e) z! b5 o Q# M! gvar cross_marquee, ns_marquee1 b: | s' F# F* O( G h6 A
4 W% k% g6 m+ J3 \, @6 x% c! p
function populate(){
' ?7 N6 D$ V5 a8 i; }if (iedom){- V' h- }& {" `3 N. F8 ~1 G
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ z9 `6 F9 U8 L z: C: \. _
cross_marquee.style.left=marqueewidth+8
0 n* [6 b f4 p6 A$ _9 across_marquee.innerHTML=marqueecontent
, [- q. r. |, w; g, z6 O1 u& @actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 [+ F: q( ` d& _2 l4 ~
}6 h, e# h- _& p% n
else if (document.layers){
* h3 O9 Z, B: E1 ]! B2 fns_marquee=document.ns_marquee.document.ns_marquee2: B! Z; ~& I) i9 \2 _+ c
ns_marquee.left=marqueewidth+8
) i9 b: G+ |6 A1 `- y6 P5 n/ T, T( Kns_marquee.document.write(marqueecontent)2 ~) y9 Q0 L( a. I' o# H
ns_marquee.document.close()3 E9 I7 \# s9 i: G$ v3 d
actualwidth=ns_marquee.document.width
6 N- w% |# V+ ?1 m}
* |* ?4 b6 X* E! p5 flefttime=setInterval("scrollmarquee()",20)" z3 `9 z% ?7 d1 Y. L# m
}
. H4 D$ g% i# s* d* d& m4 gwindow.onload=populate' \# K# @9 s) }: W& [5 a( B
3 V! Z+ k% m0 k! K' @2 ?4 y5 P
function scrollmarquee(){9 l9 g( ?5 _, I; ^# B, V
if (iedom){, l- `" r4 H) J
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, t# u. _* c# mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# O# u; J, a! lelse
1 H' H" a; C" j5 J* W# H+ }' bcross_marquee.style.left=marqueewidth+8( B/ K0 v, F9 W) ^% Z* U
3 r! C7 L, g. r) ^: D, H}7 @: r$ ^ e/ _7 B
else if (document.layers){% y- E. x" F8 F
if (ns_marquee.left>(actualwidth*(-1)+8))
3 E ]" E/ b+ ?" r2 n: Y* V, J7 nns_marquee.left-=copyspeed
) F k* P; F/ A# P ~: kelse
! n3 [' B \6 z. e/ g) ens_marquee.left=marqueewidth+8! }* ]+ k9 {0 z# s# J
}; f9 R- ^; D8 {5 }& o: J
}. O* d" ~1 h& R
9 H. d! q5 y8 z# a+ A$ g
if (iedom||document.layers){+ c/ s! a" l' g2 e
with (document){* `$ y+ l }3 a# K. P6 @& u: o
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! _: W3 F, K5 n$ rif (iedom){: ~. Q* i2 R2 b3 c! s/ ^2 ?
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); e: f- K0 k& d, h
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 X6 X" _1 H; l
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ r Z' l6 \3 A5 T1 H& v4 Y" c8 G
write('</div>')
; F L! c+ b: x. z! \ C8 P}7 s; r6 T% m9 J! g9 e) ?
else if (document.layers){
, \/ W& j+ z6 Y) \& g! |$ u; M$ Twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) i; f8 e# ^2 u2 ^5 r/ i7 G/ A$ ?write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 L7 f0 B3 l) T: ]
write('</ilayer>')
* y7 N! l$ b" o! H7 R, i) J}/ D. _8 \5 F. G: j2 D5 c3 A
document.write('</td></table>')
, S, T4 c6 p/ Z6 x5 P4 D% N, j% [8 ~}( `2 @& t5 N C9 I
}4 Y! Z, A, p4 b
</script> |
|