返回列表 发帖

网页之跑马灯文字特效

//修改宽度
1 J3 W. h! f0 u5 e+ h+ xvar marqueewidth=300
- V) `+ o9 u  Q  d* U% L* ~//高度
. W- u0 j! Z6 q( T0 W# W+ tvar marqueeheight=25" C% b; [& t, I. |/ `, `0 V$ L  W: x. ^
//速度(1-10)
+ c! r/ P( z. ~8 _' Nvar marqueespeed=3
- w& K# w5 ], k- v8 w//背景颜色
3 B6 i, m5 x1 V3 |+ W* C# F2 zvar marqueebgcolor="#FFFFFF"
3 j$ J& V- q- M2 w" M//是否能暂停 (0=no. 1=yes)?$ T  ]8 k: G# `! @) {* T
var pauseit=14 h3 b; b" M' x! l9 D
. j; P" |3 ?7 F" o" |, ~
//修改显示内容
8 u3 r. ^5 v  c( vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( x9 a9 X7 D: E

* [1 b- T' m/ w* b1 e- u6 U8 q9 ?
8 P9 d( x, D8 W2 J1 J////下面不需改变////////////) A0 U; g: Z  }) o$ ?1 m7 d
  U- M# Z" E) q) e, z6 s
var copyspeed=marqueespeed; V+ @( h1 W* s
var pausespeed=(pauseit==0)? copyspeed: 01 ~% ?% N0 T: ?' x3 b
var iedom=document.all||document.getElementById
- g6 g2 ?. X: I* u& H' R6 fif (iedom)4 d9 I) x+ z, r: u; |! A
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ B$ ]# \) }" r+ N
var actualwidth=''
, f$ |0 h( D  ]! v( [var cross_marquee, ns_marquee
6 s! y6 K8 U! g' ^# C; r" j0 H5 V1 O% ~) A3 V# t0 e- x; o& ]
function populate(){8 o8 m: `, S1 j8 z8 L( ^
if (iedom){
( c4 \2 E/ J" i6 V6 ~, Vcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 ?2 y; O$ y  p6 D4 V8 P: y1 `cross_marquee.style.left=marqueewidth+8) [6 R( d, T2 z+ x
cross_marquee.innerHTML=marqueecontent+ |* |' B2 b, v2 }$ ^
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( z7 J. g3 ], T' Q}
& \+ B2 `8 w$ ]; ?0 ]$ xelse if (document.layers){
# U# C* g0 V& ons_marquee=document.ns_marquee.document.ns_marquee2) ~, V' P# _9 z9 g" F
ns_marquee.left=marqueewidth+8
, J& R- _  l' g: jns_marquee.document.write(marqueecontent)
2 B& k" G; i  a2 T) gns_marquee.document.close()
& v' N( X+ v8 j4 `& h1 b" cactualwidth=ns_marquee.document.width8 b0 w; I' R3 u& {* l! q# q
}- f( b) ]1 ?) ?: U8 M6 Y8 u
lefttime=setInterval("scrollmarquee()",20)6 b/ P# i: I1 g
}
' B0 T2 E' v: jwindow.onload=populate% q9 A2 W3 D: R) k* x! Q
, `+ }0 W. x' K( D" ?7 O: `
function scrollmarquee(){# l4 s% r0 g+ c7 ^. Q5 S0 }
if (iedom){: V4 C: [( A; U
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 k' ?0 }7 ^& y0 ?( t4 G. F" U
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. R0 H) g  d5 Y( N# ]7 Z; S
else
4 Y7 g! K6 e/ dcross_marquee.style.left=marqueewidth+8
3 A9 I7 ]4 W& ]0 ?; R9 j  U7 A$ y! z. H& e9 b
}
0 D1 Z# h/ e1 u$ q; J0 H! _6 melse if (document.layers){
. \, [% v  `- ~; U5 W6 uif (ns_marquee.left>(actualwidth*(-1)+8))& L( Z, l4 _# a2 \7 A6 H$ {& D/ R
ns_marquee.left-=copyspeed: n0 G* N, m' c
else- ^( J" _% z6 V' \% D
ns_marquee.left=marqueewidth+8: w/ J0 J$ b( B
}0 ]6 z. y8 C2 _# H
}% Y$ j: L& D8 o5 z1 m
' J! D5 d. k1 W6 D
if (iedom||document.layers){1 N+ i. N) c  H  p1 r
with (document){
" o  y6 S8 r# L. Edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! E$ N5 o& L; y' o: Eif (iedom){; P2 _1 {1 z% I# V, r, M
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 [- c. k6 J6 q) F0 ?! A
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 {" l5 A1 q: o- ~  ?" X
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 I% Q) I9 e7 f: p- ?write('</div>')
7 H4 z- x$ q# I) D' f7 A+ C  M}& u( u, x& _: s9 r3 D5 }# t2 q8 L- S
else if (document.layers){
1 e+ H- p( j" b! |write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- S: _" k* j; r9 R4 O' i! f% o8 awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 |2 R9 k" j3 C- R6 Q' B/ z
write('</ilayer>')
2 u; _" H% f$ u8 s}) S7 S# [0 V9 K4 k  ]
document.write('</td></table>')
! L$ c* y. c2 l8 O}
9 R$ B# i: t/ J0 k* }$ r/ N}
  Z3 s, g3 V) F+ X9 _9 e</script>

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