返回列表 发帖

网页之跑马灯文字特效

//修改宽度
8 E: s0 g3 @" ?" r9 uvar marqueewidth=300
$ \3 H( Q0 p  X8 g' U//高度
3 j2 T, U# C% X5 t  U$ hvar marqueeheight=25' b4 U; T2 A6 x! w
//速度(1-10)
; p8 @) U6 S* f" N; G4 r5 Xvar marqueespeed=3
6 H' l$ ^2 F+ E: P# x/ F//背景颜色* `- @6 ~' r7 p5 L7 J8 C# P
var marqueebgcolor="#FFFFFF"# e7 [7 o* M# Q1 Q" J
//是否能暂停 (0=no. 1=yes)?  v+ c) p+ `( o
var pauseit=1. n3 [  U( r: ~, n( o( r

* ~' M, j$ F; `% o//修改显示内容: A) k& v1 \' r+ i
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'  r9 A1 z* D, Q+ I" G, |
2 T5 a0 q. V3 m4 r3 h1 N

$ f4 l( Y/ w9 D7 ~4 A; z+ d/ H////下面不需改变////////////
& X; Y% W) l/ ^, l: C
" f2 @' ~% h6 ^var copyspeed=marqueespeed
8 k+ l- [3 ^' F0 f) _8 d& ~var pausespeed=(pauseit==0)? copyspeed: 0# ?. v# ]7 @& R' e/ Z6 L
var iedom=document.all||document.getElementById4 S7 O- r1 k: X- D5 C
if (iedom): C2 k! l. a, c% d4 R# @# q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 g9 O$ R- ]* h3 ^  zvar actualwidth=''
$ A; I) m9 H- Tvar cross_marquee, ns_marquee
! N; d: N. O6 a) m
# p$ @5 }0 `1 m* n2 ~, j7 u. Afunction populate(){0 a0 f2 L- X$ Z  j# z
if (iedom){
! {  V* D7 y- M1 Bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( J( Y1 m+ m' Y+ G4 [cross_marquee.style.left=marqueewidth+8
) W+ E' t# l6 X+ P. {+ {  \cross_marquee.innerHTML=marqueecontent
/ C0 V5 L7 M! {+ ]) n* c& }; Xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth' q! l4 w4 w: w. I
}1 b7 q9 n: n+ _' i% q
else if (document.layers){. J- W" ]  ~6 {) D# V
ns_marquee=document.ns_marquee.document.ns_marquee2* F- X! a6 U0 E# L, T# r+ k: N
ns_marquee.left=marqueewidth+84 g# Y% x( Q% b( Z; y. V
ns_marquee.document.write(marqueecontent)) o$ e" I+ N( x" X& c# c; a
ns_marquee.document.close()/ |$ D2 Y% z' f7 i/ c' |
actualwidth=ns_marquee.document.width9 z+ F5 X, C. S( Y  |3 [4 _1 h+ B
}) e; G) l& Y$ {& V, R/ O
lefttime=setInterval("scrollmarquee()",20)
; r! l& K, Z. [; D4 {}
6 `& e- K# C0 Y3 a- g+ |! x0 ^% Nwindow.onload=populate6 t3 H. K( f$ W/ J# w+ k

0 N: ~% {$ l  U0 C2 {$ kfunction scrollmarquee(){" d# ]5 t+ x7 t# K* ]) o+ \8 n" d" m
if (iedom){* a6 _, c- f5 G
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 P/ V3 e8 P( J$ i1 m, p
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed  t. t4 ~. S( u& W
else
+ G6 O! i! i% X) y# \8 J$ L1 Qcross_marquee.style.left=marqueewidth+8+ N$ `( E5 W9 @2 Y8 b

) w0 A( [2 O' o& J}
$ d& ]2 p0 ?: t7 T- Z5 p  Yelse if (document.layers){
. o/ D# a# ]* g) H: _: V& ?if (ns_marquee.left>(actualwidth*(-1)+8))3 o  ~' d' p# \6 G+ `
ns_marquee.left-=copyspeed
% {, c9 r3 A' c& B& Z- }2 Eelse- ?* u+ y" U7 d
ns_marquee.left=marqueewidth+8; i- p2 \! c% ~# f- b7 A- C
}" o, k% P+ s3 K4 R& M9 c
}) Y+ ~7 A# |9 E$ `0 |' D

& |3 C% `( K# N. |8 g* eif (iedom||document.layers){0 e0 E" a, A1 S1 U  `( ?6 F
with (document){
* f" g& s/ ~* k2 L) M, Zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 ^/ K/ j) n4 ^" T& |8 Yif (iedom){
0 ^! r3 ?$ e" u0 Y# @write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
  D9 |) _& g7 x8 K3 y/ n$ Bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 L' T' [) X, z' S$ u/ R: h
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# p8 a4 g$ c( k
write('</div>')
& H9 t( m5 C3 ]$ u- q  W3 Y3 w# ~}% Q; z/ L. x& I" `" ]
else if (document.layers){
5 |( Z6 F# T* o3 {6 E" ^' Gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')0 s7 }& D3 J) Q
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- i1 X5 q% a+ M. e  k9 w
write('</ilayer>')
/ ~( Y! U# y6 Q0 ^}
( W, V3 a/ L5 g. kdocument.write('</td></table>')
; S; C* @4 ?% _8 Y}
0 d1 [, Z& T/ G$ h6 J9 F* P}8 q3 I" N7 Y3 U- m2 B7 X; u7 x9 \
</script>

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