返回列表 发帖

网页之跑马灯文字特效

//修改宽度
* v/ v3 j- @) G, Z: ^/ \" Zvar marqueewidth=300; \& I9 H- D+ q. Z7 h' a
//高度
, c& F4 W# z, S% U& m/ m6 Lvar marqueeheight=250 U; V5 `5 u( W7 b  V
//速度(1-10)
# `$ y, V& Z% M" n0 evar marqueespeed=3
2 V. c5 L4 ?, p//背景颜色
+ N& c! C$ c& C4 Z7 vvar marqueebgcolor="#FFFFFF"
6 s9 n$ V- E+ S. [  t! q% v//是否能暂停 (0=no. 1=yes)?
( W. l' k* X. p7 I2 H4 X: b1 Zvar pauseit=1
1 v& z. i6 v, A" @+ G$ q% d- N. t' }; H9 d+ L
//修改显示内容0 n" L3 b% Z) ?
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ C) f# _9 {8 {; Y0 b5 H* U% o% D. q2 M& g4 l* S  H$ @0 C: J7 a

: N; l7 e5 n, T////下面不需改变////////////6 ^) B, s. P  `. z+ R9 C9 L
! n1 r& }8 z' b2 d+ F/ Y
var copyspeed=marqueespeed
5 N8 U+ b9 ?9 Q; G4 tvar pausespeed=(pauseit==0)? copyspeed: 0- z' I+ O# `" n: Y" e7 t
var iedom=document.all||document.getElementById
  R7 ?; O  p+ ^if (iedom)" C, t4 G# s& ~. g
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ B8 Z9 T5 D3 L6 pvar actualwidth='', [6 `0 S0 {3 ]6 y0 k4 q
var cross_marquee, ns_marquee
: J2 b! r; p7 D% x- W* F0 y! y6 l0 G, E- \4 Y* y
function populate(){% C. Q9 {; G; {2 i  d8 D; u
if (iedom){
+ e! \/ I: X, _3 Y' L$ j0 |1 |2 fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% F6 [9 f; P, _4 u; n( k; C
cross_marquee.style.left=marqueewidth+8
3 y9 g) a' v/ gcross_marquee.innerHTML=marqueecontent, d& z% a% Z' A0 ]
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
4 f$ ]# @" |/ C6 q}  N& L' j) z; B. C! g& G$ p' w
else if (document.layers){( S. N& T( K5 A% s
ns_marquee=document.ns_marquee.document.ns_marquee2
; _: F6 g" B7 j2 {- Z+ q- ens_marquee.left=marqueewidth+8
* V4 ~+ b1 Q5 u. Y& a& N8 Ins_marquee.document.write(marqueecontent)
$ C  a/ [6 N  Sns_marquee.document.close()
- \- b3 \0 O  v; Z( f, J/ Mactualwidth=ns_marquee.document.width
1 R- A1 n- P4 k/ x5 r8 S8 h. ^4 G}" U; R% i8 E) _8 l9 Z2 _
lefttime=setInterval("scrollmarquee()",20)
) H2 m. b7 P0 t9 Z+ i}
- v. O* r  b: c( Swindow.onload=populate  z: N' L( n' `( x& f6 P5 O
3 W' j; s2 i2 R- w2 A
function scrollmarquee(){8 Z, ~+ o6 Q' i( }- D6 N
if (iedom){
4 e% f' Y2 {7 r) n& T" ?if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 q* D1 M- M. [/ Ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 i2 p) N8 z2 a: Pelse; a" P# T; y6 N0 E$ s
cross_marquee.style.left=marqueewidth+8) L6 ]8 M- S+ X

/ k$ z' _* W- f0 ?3 {# @}
1 x& Y3 p  {- [" f) u( {( `else if (document.layers){" _( w$ X0 C0 ~1 o5 p4 [
if (ns_marquee.left>(actualwidth*(-1)+8))+ k" X0 V2 d# R6 a( C! X
ns_marquee.left-=copyspeed; g& n. n& O% D5 q/ S
else
& _7 k+ D! ?( c( i/ d6 Dns_marquee.left=marqueewidth+8
: d7 N& q7 f# d. C}
. n8 e9 b. d1 k}, `* w- X1 E) b3 x0 L0 ^

( y0 [9 l$ s6 W7 gif (iedom||document.layers){8 p+ C' s0 c- `: o' w
with (document){
" z! d8 M+ ~* {( A1 B0 Z+ f& ^document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 U9 S, |+ x, P4 M; q- K
if (iedom){' y' h# B2 m) m+ y+ B, Z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 ^( u6 I# g1 z8 Z! D
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 E  b& D( n& E' z, w0 b# l
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% O* b# ^  d7 n7 K4 a
write('</div>')
" V8 [2 D/ J3 |$ [, s; ^; y, M}; Z3 K, Q+ K  l3 ]
else if (document.layers){- ]* t0 I8 `$ \, r
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ z/ b* n* y* q+ L2 o
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 s5 Q1 Q. L1 ~" ?, O
write('</ilayer>')
2 ~) V* g: w: Y; q- P}
6 L9 `# \7 ]4 ^3 n/ R$ o0 L  x$ ^document.write('</td></table>')
# a( J/ k, s+ n9 A# g6 C; d/ a}
! ]. x% W3 F( V$ O( C}1 K0 r5 K5 Z3 u9 J3 K$ K
</script>

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