返回列表 发帖

网页之跑马灯文字特效

//修改宽度  t: _$ b' e; Z; d" N+ X2 |
var marqueewidth=300
# b+ r4 Y( _# k3 w" k  ~& F9 o9 T//高度5 m% I) L( h  r7 [0 q. j. Q/ f! \
var marqueeheight=25% w' c; x4 Q" B
//速度(1-10)/ B/ Q8 m8 V$ ^5 J3 W
var marqueespeed=3
4 J! v: x4 n, F4 q- l//背景颜色- u# w" Q, J+ n1 p
var marqueebgcolor="#FFFFFF"! P3 X8 O) a/ |3 G4 W  n2 g
//是否能暂停 (0=no. 1=yes)?
4 S, ~4 ~6 j: Y8 Xvar pauseit=19 e- `* U* a0 Z' `0 {: g  Y, a

! p2 a' `5 L  Q( m//修改显示内容
6 ~+ ^# `. m7 y% Zvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# p$ c* Y9 T/ [( x0 Y5 u: U
2 t9 r9 s1 m, e2 }/ X
  |% ~' `3 T0 [2 H
////下面不需改变////////////
! q, p" P5 i3 }$ O1 e& T, I- I7 ^& x' `$ v: c
var copyspeed=marqueespeed, h5 I% Z; b" I, z6 V
var pausespeed=(pauseit==0)? copyspeed: 0' L2 X5 V2 k6 x3 @. j1 L
var iedom=document.all||document.getElementById
1 H- s* s5 A; Z/ {0 q2 R" q7 u! nif (iedom): [+ E# i/ E: |
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 n; p, {- R4 C9 ]& ~- _8 p
var actualwidth=''# ~8 j& J: @$ H5 V
var cross_marquee, ns_marquee. \  }) R, [+ {. Z6 c5 g$ C
4 w1 R' [" Z- Q
function populate(){5 \# M. D8 K( g0 ?; c
if (iedom){" l' M6 i' Y, ?& _8 B. r# W; Z% D5 w
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; a  A- D& Y; c# Zcross_marquee.style.left=marqueewidth+8% z5 g/ l, c+ [& ~" d
cross_marquee.innerHTML=marqueecontent
6 C8 E4 B. N9 ^" k; G. qactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) X' q: p& l; l4 `$ R+ \3 ?}4 s' \. {! J( G! o( J7 G& l- x
else if (document.layers){
7 v5 b! l; C8 \/ o/ y- fns_marquee=document.ns_marquee.document.ns_marquee2$ r2 O; K/ X3 @% ~  D4 }
ns_marquee.left=marqueewidth+8  t" I2 ~2 _' V" s
ns_marquee.document.write(marqueecontent)
# |2 X& v8 G6 ?& C: `ns_marquee.document.close(): O, O1 r+ g/ A+ |
actualwidth=ns_marquee.document.width, s  o/ \  k5 H1 r: e$ U* |
}0 M& p7 B* l& s
lefttime=setInterval("scrollmarquee()",20)
( F0 b7 x; I9 ^9 S# X5 }5 s}3 V" h; Q/ E: P% d* i6 M
window.onload=populate; s  }6 m2 X0 S$ ?0 i- a

- O$ K# u8 i) `9 j, \( F" n" b" H; Gfunction scrollmarquee(){9 \" _5 z% U) L
if (iedom){8 t. D; ]! I8 R4 ~7 ~/ W
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))- S2 @4 X3 e, K2 S6 P
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; C6 C# e* \% I, selse; ]6 j: N1 Q1 e* X) r
cross_marquee.style.left=marqueewidth+8# n; S" X" X9 H* L& Q
) N% v; G5 j6 B: A# V
}
, U1 b  [8 z, J, d/ M9 p# @else if (document.layers){% F4 k* x: [' {7 G* P/ n0 ?4 x$ S
if (ns_marquee.left>(actualwidth*(-1)+8))
' U! r. e) I& A: G' i% i4 r) rns_marquee.left-=copyspeed# D5 s2 g: g. _; [) f5 _" U$ i
else
9 I# R# i7 l! ?8 Jns_marquee.left=marqueewidth+8; L4 c. d( w) Z
}
6 ?0 t- p( n0 o" C4 @1 L4 F}+ C4 z# `9 Y: w; r" Y! ?2 i

0 J4 w" U" e% ]5 R7 tif (iedom||document.layers){5 y3 I' n9 v3 X1 }6 ~; q
with (document){. ]( ~* m; U3 n5 p: Q
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 m9 F% `, w/ C, b/ k- S
if (iedom){5 [3 I. P  I+ h* \) j+ c
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). |5 K1 e, K$ U' G7 d. U
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ u% G4 |* L2 v. J" e( J
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% E  m0 {! ?  qwrite('</div>'), ]& c) ~7 ~" }- n# J3 Q
}
) ]5 N/ }* a$ W- B( L3 N0 ~/ gelse if (document.layers){$ _: |+ e& y+ j8 L) u$ W
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ e! l; E/ t8 I; zwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 m9 u( b0 U& I* ^  ~% pwrite('</ilayer>')" z( W8 s  P: {$ G1 d! n
}' p! E, z* h5 A& y$ F6 K4 W. g  E) j
document.write('</td></table>')2 Z& O! W0 T; F3 l) m
}7 X" ^& f; U9 n" f, \
}
4 e3 w* h0 T; d5 \% P9 n/ y</script>

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