返回列表 发帖

网页之跑马灯文字特效

//修改宽度
8 p# e3 w8 b1 _, J7 avar marqueewidth=300
/ A% @6 p, U. |//高度
7 q- T& O" `  \! ]; ?var marqueeheight=25- ?& K. t/ S; T1 F1 m. Y# d$ \
//速度(1-10)
8 X& }* t. o( M/ p4 ^  Q  W1 l& h7 [9 lvar marqueespeed=3* P/ }5 J9 }7 a/ j9 N
//背景颜色
: }7 M8 q& B  _) \' Svar marqueebgcolor="#FFFFFF"
. h, |+ F4 m2 _: O//是否能暂停 (0=no. 1=yes)?, \$ Q) V, G: W, l2 h
var pauseit=1
. p: m1 D1 `% D2 f; M- f) L1 s& ]- r- c- Y3 E4 e8 p
//修改显示内容4 m- w2 q6 J! |/ m/ x
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( n1 t: _) j! M- [
' Q) i6 L9 _' Q, w- g. l" w( ?; p! D  A+ y9 Y0 ^2 S! z4 H7 B4 h
////下面不需改变////////////, [6 Y/ M! ^2 E) n+ c. Z* h( }

5 r& ?( I* N) V. |! ^4 ~var copyspeed=marqueespeed
# e- n! q9 k8 O4 @var pausespeed=(pauseit==0)? copyspeed: 09 B7 u$ S% w' Q# I" Z' x
var iedom=document.all||document.getElementById
# F9 f. U, L* a* Z+ n( M. Fif (iedom)
( A* k8 x: H4 Q+ p; ^document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
4 K% }2 o$ @+ W; t; O- F# uvar actualwidth=''0 a; _& O9 V* I8 L$ b7 t) }
var cross_marquee, ns_marquee0 Q& g! m8 t9 G/ q- d% U: I2 T
+ l! n9 h; \. W: g5 W  ^
function populate(){
% k, L" Z6 |$ Z1 F) s1 Kif (iedom){
7 g4 c  e( q9 i, z( y6 p# ~cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
" m" z; @2 D; t; H9 K; B1 G- Ocross_marquee.style.left=marqueewidth+8% ?5 A' V' M& F6 }. f3 O$ i3 n
cross_marquee.innerHTML=marqueecontent1 |# x6 n# f  ~$ `' r, |
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth/ Y: M+ o* D6 X
}
2 i  e( E8 l( qelse if (document.layers){
3 M$ L- _5 W* I3 jns_marquee=document.ns_marquee.document.ns_marquee2' j' v2 |: [; }! X  z
ns_marquee.left=marqueewidth+8
; u& W. ~: \5 {! N) R8 n. Zns_marquee.document.write(marqueecontent)
' a0 K9 H8 M  X; hns_marquee.document.close()5 x* O+ a. q" c. s* d
actualwidth=ns_marquee.document.width5 V* n0 E# v7 [8 X. r
}
( t0 j  j5 o+ l4 ilefttime=setInterval("scrollmarquee()",20)  m& Q7 o; Y) O
}
+ G. u. D* k$ H5 cwindow.onload=populate' G* p: v( @9 L/ R
8 E) R# D6 Y0 o( ]1 |
function scrollmarquee(){
1 ]' B5 @# }2 _* ^if (iedom){3 B* @3 w8 Z3 C
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( F0 ^, I- N8 ?+ C2 j0 }; h
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ ^8 q' C) S' z% ^' `4 c1 e
else
5 G0 T- E4 V" Z% h1 ncross_marquee.style.left=marqueewidth+8' G+ Y% I9 w6 Q2 ]+ E- y
8 C) i7 F4 X3 s- O! d& y% u. {5 o
}
: a& j- S+ G% P' \' t0 O2 J% m  ~9 ?else if (document.layers){7 q$ r! F, c  a& e/ o6 H* a. H
if (ns_marquee.left>(actualwidth*(-1)+8))
+ g  y1 `% H& o) P, G+ r5 cns_marquee.left-=copyspeed, I' U. w% P+ s+ d, D
else! P& t4 Q7 A! Z3 |% O. m! E: V
ns_marquee.left=marqueewidth+8
4 \/ v( g8 x: |}# o, [! U$ n" @( R# t! q! ~
}
, w, m/ O$ \$ t9 m
8 i6 I8 g( j& M/ l% S0 Uif (iedom||document.layers){. L. [8 }! r6 I! A$ @+ d
with (document){# e$ o' \. E# W1 Z
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 s$ d7 s: T* m, dif (iedom){
/ B$ x8 v9 L0 jwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ c( h6 C8 l. E! |# v& twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). r) ~" B6 p9 E
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) X  q! a, o) Owrite('</div>')
: _% k' [, H, P+ Q2 }6 O  U. V}
! x  @9 o% P3 `: D& t  Q, Q5 U2 Z- Eelse if (document.layers){) h$ G8 y1 C! P+ o$ \: b+ Z$ C
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! t9 x5 K% X% L/ L: T% x
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); D4 t+ b  u2 u
write('</ilayer>')
$ e2 [( ^4 r3 g( P, [1 y6 a8 W}- H2 f' g7 s# p' D* @1 _) c  q
document.write('</td></table>'). \6 P3 S, c/ {4 C' p# {& h
}
+ P) C+ d2 Z2 L}
; v4 ?7 \% C- O" r5 b</script>

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