返回列表 发帖

网页之跑马灯文字特效

//修改宽度
! x8 A/ j9 |( L% f4 ], x# [var marqueewidth=300
& m/ O2 k, R3 I: d! t2 i% l//高度; Y5 [: e6 K% H' P
var marqueeheight=25$ b( T3 h- i4 R7 x
//速度(1-10)( W  e- ]# z: M/ w' Y6 Q$ O  \3 \% b
var marqueespeed=32 K3 b4 p- T1 Y3 W
//背景颜色
4 e. y% Y, |! Q; ^var marqueebgcolor="#FFFFFF"; k; z4 ]1 ^2 `% Z1 B4 l$ X
//是否能暂停 (0=no. 1=yes)?
- o( F: s4 @! `var pauseit=16 \; r$ v% @" q) |9 W

. U: O* a- {) s$ H! J! n: s: a9 Z/ s% @//修改显示内容
0 @" Y% u( Y  W3 Gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" r0 ^. k, Q" W) L. m& ]6 c
* l! d9 z2 T. e( `  f
! c3 ~; C' _( H7 D/ |////下面不需改变////////////
* Z2 A9 G+ ^# z$ y! U4 a1 |# V& L9 I
var copyspeed=marqueespeed
, q6 m0 q! t- g1 dvar pausespeed=(pauseit==0)? copyspeed: 0
6 h" v( S9 x' [' \9 Q3 e4 ^& Rvar iedom=document.all||document.getElementById) [. s* n/ |4 o3 ^
if (iedom)
- \  I) g- {3 i! c1 Sdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')# h3 P: f4 |8 L  t3 ^) d
var actualwidth=''
9 R' j/ d, U, }* B7 M! [var cross_marquee, ns_marquee
) n5 c9 Z3 W& A. H% Z' s' T4 B; O& z, q* G6 v! m
function populate(){* E# V/ a; n, L" ^* f
if (iedom){8 X) ~/ W0 J: z. F
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 a. }6 R# I+ c9 Q: }; Fcross_marquee.style.left=marqueewidth+8
/ ~3 |& m* }* D/ ?cross_marquee.innerHTML=marqueecontent; A$ ^$ A' L5 w
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" [7 A; x. C1 F}* e) k/ H7 L9 t+ e) C
else if (document.layers){# b& K2 Q* n4 p) r* F3 C+ t
ns_marquee=document.ns_marquee.document.ns_marquee2; I7 J& L9 F: y( ?: _) g& x4 C' l! z* }# X- I
ns_marquee.left=marqueewidth+8
! d9 o& e7 f- _9 M; C1 x6 Vns_marquee.document.write(marqueecontent)
: u9 A, O5 p2 W! i5 ?0 sns_marquee.document.close()! f- M  x, ^/ L# ^' z8 [1 z% e# c
actualwidth=ns_marquee.document.width7 r$ I" R8 V1 `, X
}
; N& L' ~# F9 w) x+ i) Z. E2 P: Zlefttime=setInterval("scrollmarquee()",20)
1 n, o/ i, X: g( a0 K$ S}
' M+ C; u  J9 G/ F% owindow.onload=populate
$ T$ |. A# W5 @! g) B; G) p1 v, ^' W& j
function scrollmarquee(){' }' x4 U- s6 ~* v) _* C
if (iedom){
8 x% G7 ~1 z3 R1 s; d. k% `1 fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))4 C9 b, Q7 P$ r) i/ E+ f
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& T9 R0 c* K9 e: h; x
else8 @# i8 r6 U( c
cross_marquee.style.left=marqueewidth+8. g1 k0 c" h) @, V/ f2 L

# d2 u: O: `2 a& K9 i. j- K9 a}
, @2 w" P4 [* j3 X6 Qelse if (document.layers){7 R+ x: g, V9 g$ X5 Z1 ?+ W' m5 e+ `
if (ns_marquee.left>(actualwidth*(-1)+8))' [' ]* v# `; u
ns_marquee.left-=copyspeed
8 S/ o5 X2 C- d( Y' Yelse  p- j7 x8 H  F- ]8 W
ns_marquee.left=marqueewidth+8; ~& a  ]( E* a0 H3 c) D
}
$ s6 P9 q  I3 r- q* Z! g}1 ]: R* g0 N- k0 V% @* `+ q

; S2 ^6 e2 ]2 hif (iedom||document.layers){# X& V( h( K1 t+ l
with (document){
5 L& Y2 n$ p, C$ m. X: Ydocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 g4 S; @* H' C* A# T
if (iedom){
) F* }3 V6 Y* c. _7 n# dwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 }" c9 r) c9 o
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 X6 K9 T! M8 ?& A% u
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! s- h2 X; C. o- a* S
write('</div>')
" ~5 r& V# ?) x9 |}
( s: Z# i# k! T$ }else if (document.layers){4 I7 A! w: a; L( W: H
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 j- b1 G9 c( F- {write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( C- V# y4 ~3 ^
write('</ilayer>')
0 ]5 Q( z& h/ c0 a0 I}2 E- z1 i$ b$ J  H6 D; Z
document.write('</td></table>')3 x3 \& M$ U2 _6 D; D+ Z+ a
}
- A" _+ o4 l( C: k}/ j8 b0 q0 M& Z# p5 |
</script>

返回列表
【捌玖网络】已经运行: