返回列表 发帖

网页之跑马灯文字特效

//修改宽度
, N6 {1 [$ g/ p+ I! V& \2 Nvar marqueewidth=300# y5 J5 z! s2 M
//高度
* v+ j0 I" h( |/ s; S( vvar marqueeheight=25
5 g. k3 h8 k$ K/ e4 s7 }//速度(1-10)0 _' p5 p  ?; H% i4 R6 f
var marqueespeed=3$ M  q5 K" V' ?% @0 T
//背景颜色$ |& Y$ L, b2 Y  o/ S
var marqueebgcolor="#FFFFFF": A# ~9 A9 N" @' W! C
//是否能暂停 (0=no. 1=yes)?) N5 {4 q8 k; S( u5 w
var pauseit=1
9 u$ z2 {: U) c  I5 O/ ~# ?
" {5 }" f1 K) A+ M$ _- J. I//修改显示内容( }2 G3 O8 k& `: m2 R$ \" H
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. c- N( ^5 E; \* b  u
4 f* z# s" r/ m* f2 F# Q! N5 r
* j+ \8 ^) m; h0 A9 p////下面不需改变////////////
' R' K: v  y: H) T
  ]9 P0 n5 q, [$ ^* u3 r+ ~var copyspeed=marqueespeed, l( M7 ?, J- W# G" K4 s
var pausespeed=(pauseit==0)? copyspeed: 0
# \9 a4 a+ k8 C6 U. A% Tvar iedom=document.all||document.getElementById+ P2 M8 J; A; N8 a0 }: J! H
if (iedom)
  k! e% x4 M1 F4 ?document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 l4 V2 P# m) w! C9 k; G" tvar actualwidth=''
. @" A) N3 N: s0 H# i1 Y! P: w% s5 Kvar cross_marquee, ns_marquee
7 S0 x0 A  H# J2 V0 g
6 V: f, n% O; y( o2 }function populate(){- s* l1 i/ {  M9 u
if (iedom){8 I$ `* b  t0 {9 f% W4 M
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( S3 G5 R: D& {3 P- y' @
cross_marquee.style.left=marqueewidth+8' E$ A- L. a) p
cross_marquee.innerHTML=marqueecontent
7 G* I4 R( X- N7 L  L8 pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! `" [. y& _5 Z4 z& |7 Q
}, a8 g( ~6 e4 I8 x( h9 y5 l
else if (document.layers){" G2 P, l4 T  |
ns_marquee=document.ns_marquee.document.ns_marquee2
- j! R, \  ^, ~ns_marquee.left=marqueewidth+8) f% T$ i. a2 ^
ns_marquee.document.write(marqueecontent)( K* l, V+ T: O3 C! v# m1 n
ns_marquee.document.close()" t0 }! {! a# G4 N6 \
actualwidth=ns_marquee.document.width
3 ?* f' n& ~+ a}
: J) j# T5 @- l4 A3 Ilefttime=setInterval("scrollmarquee()",20)* M) ~2 y0 P* S0 D
}
3 l! S: v3 [5 xwindow.onload=populate7 D7 k1 X( Y0 v6 p
* Y) s" |2 v) V' F$ O$ [" {
function scrollmarquee(){
4 O8 k. J' i# D% H9 ]- |if (iedom){- Z; V; w+ D1 q' k
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ R' |! J5 o% f) ~6 Z/ F3 B
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 ]" l! k. B, n6 ?) `/ eelse
$ G9 g& a( g$ C" g% D/ ycross_marquee.style.left=marqueewidth+8  ^1 l9 C7 u$ _- ]$ ?+ A
) S7 T( @7 t1 P- Q$ l" T& d
}
: C, A8 e) \( S, `) Eelse if (document.layers){, Y/ S& U3 a1 R/ G1 b9 z
if (ns_marquee.left>(actualwidth*(-1)+8))
7 C0 V8 e- \2 G7 Ins_marquee.left-=copyspeed
, E! N. r9 L8 D5 e+ j; v: B7 l5 @: Lelse4 E& d( G& g" a8 v
ns_marquee.left=marqueewidth+82 z3 ?8 ~2 k3 W) x) W2 B
}
# i" A8 r' J4 @/ c) ?8 Y9 z/ ]4 |+ H}
6 ]7 k  W: A$ E! w, A, G5 A' E$ ?( G( C+ q
if (iedom||document.layers){' X& g7 F* q6 F6 N  ~
with (document){$ @9 y# f5 I7 r% K; O3 d
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 ~7 h/ j9 M% Uif (iedom){: J% e5 w# |7 u7 W
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; i) l* `) F1 gwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
% v  ]; [" C, E+ Hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 q/ k# J9 Y4 {' I( k6 E0 P: cwrite('</div>')
6 M$ b! B0 i: c+ t$ A# K}6 R) K/ v9 y6 M1 K
else if (document.layers){( ]' Z7 b$ P: x
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! C, ?6 i; t* y" E9 u. Uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 G" X$ H! X! p, M3 N" R4 B- {7 f1 M
write('</ilayer>')
* q0 n/ G/ s8 U! D2 R+ k# \: Z}
* Z- ?* c( i7 d6 s7 [document.write('</td></table>')
+ m) W- B; [& p) t+ Q7 X; F}
* M$ a( x9 D) j" b# f2 i}: p( v( i1 c+ V0 D# g
</script>

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