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

|
网页之跑马灯文字特效
//修改宽度
4 }2 ?* [5 P, z8 _+ Tvar marqueewidth=300
. E5 \" q6 } s) H' i) o//高度1 u* k6 d4 w( z. A* N6 |* P* k: R
var marqueeheight=25! W H7 C4 Y1 ^
//速度(1-10)6 r6 ~% U5 h8 |! K9 d# r7 ^! Z
var marqueespeed=31 H7 T' q9 c& G5 z! h$ D
//背景颜色
( z) B2 ^1 t; H& j: s; Pvar marqueebgcolor="#FFFFFF"9 f3 N8 _( N: ?: X8 K
//是否能暂停 (0=no. 1=yes)?, U- [4 s1 a; F5 h; O
var pauseit=1- a. a3 y! u. {0 h8 @
# }9 A$ k6 T _9 _6 L$ k4 s8 I( y
//修改显示内容$ [" r0 N4 V& j% Q3 }& B6 r# Q
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'4 ~8 k+ k% S. l$ ^8 e: H# A
! i5 A# @, B9 l& t0 k! E4 f! J+ k l7 j
////下面不需改变////////////
6 V2 ]6 e6 s5 z
0 H4 F5 ]4 Q, i2 uvar copyspeed=marqueespeed
4 k; O/ }7 l, h# D! w- ]1 Dvar pausespeed=(pauseit==0)? copyspeed: 0
; `0 p' p* g# D* M$ l. vvar iedom=document.all||document.getElementById
; ?$ C! v# ]1 [4 p! o+ Q/ s' `if (iedom)
' |, X% Z0 L, g3 J# f5 odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: V. p( N7 y% Uvar actualwidth=''/ J* H+ s2 G- _, X+ |& W
var cross_marquee, ns_marquee6 f" L6 z: W, c/ R
6 R7 i. A7 k3 n2 t. afunction populate(){
0 \3 ~8 M: A( b n" ]if (iedom){( B* R3 m) q7 h# u4 s7 b
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee: j* d( H" {3 _
cross_marquee.style.left=marqueewidth+8
; ]0 Q) n$ n+ j: N% w2 A' dcross_marquee.innerHTML=marqueecontent
8 A' O& u1 ~; l9 Hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 _% ^. Z- B+ j% m
}
5 I" M( S& m; ]2 d# q+ s; E) p H8 Telse if (document.layers){: h& n N% Q% L: S$ j( r
ns_marquee=document.ns_marquee.document.ns_marquee2
6 e- m+ b& E4 x! A Cns_marquee.left=marqueewidth+8
! G8 Q) p$ y& H' G2 y/ {ns_marquee.document.write(marqueecontent)) I1 C3 S/ b$ k! g$ m9 @
ns_marquee.document.close()
$ h$ J3 u, c0 s% N3 J& O% zactualwidth=ns_marquee.document.width
/ ]( x: w" Z p/ g1 ?( @ L}
, S7 _: p0 d! A, \, Ilefttime=setInterval("scrollmarquee()",20)7 }4 |% T% j4 _+ _; I
}
# y- [% k' ~0 t' X0 Awindow.onload=populate; E* Q5 m- [ H! ~
8 i! f5 t; @1 V* cfunction scrollmarquee(){. b( U( A+ E3 [& z6 O3 D: H
if (iedom){
! s4 b% @9 t; m: D4 Xif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))& z T' F' ?, m
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 `9 {# x' ~6 J
else4 m; o8 q5 z; [, u M
cross_marquee.style.left=marqueewidth+85 X" o- ?) ~! Q
) w6 w0 J1 f/ w Y0 v4 M
}
0 z& Y7 C$ `5 ~, \9 m/ a S3 ^else if (document.layers){. W S" H( K, ?+ y' U
if (ns_marquee.left>(actualwidth*(-1)+8))9 @% g5 h# L7 ]! G2 M9 L
ns_marquee.left-=copyspeed2 D/ b! L1 @2 _8 ?! J1 V" |* m
else7 B2 D4 m) h k" ]1 d$ V
ns_marquee.left=marqueewidth+84 U' m' M; \, F+ y! K2 P3 u, S
}, Y5 u( p: C6 T1 m
}
( O3 o. ]6 {) y" X, N! E# c' ^8 _5 X2 B4 g
if (iedom||document.layers){
8 y U! Z6 r+ o- kwith (document){
5 B/ H" k0 `+ O. qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 e. ^# R5 z+ T, H9 Oif (iedom){
" y7 v3 g: Q) I2 F* t# K* f/ i, bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 J _% I) a. d* w
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& i% H/ |, n+ {' g! C: E
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" a+ F4 E6 m8 rwrite('</div>')( p. l0 W0 s2 |7 q2 T
}! i' V) i! F, u' g7 {9 p0 v
else if (document.layers){
' Q" u# B: R9 ^* j+ Y) Lwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 U; p X0 `# u5 C, M" d; Z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ w7 V% G0 H) C, p
write('</ilayer>')
( R4 j2 M) \6 X, p8 }3 s}
3 j& j! D" s0 H5 D O kdocument.write('</td></table>')
6 A0 l9 U, k1 S+ u$ N}2 h3 f! ?1 Q7 {
}/ Y5 @' K% t1 l& @ z5 T5 r6 T
</script> |
|