返回列表 发帖

网页之跑马灯文字特效

//修改宽度$ m2 I$ q' `9 F. U
var marqueewidth=3002 f! A/ f! ~2 \
//高度
- D; K6 V) }8 O" J+ A5 U* `var marqueeheight=25
' R- x7 C" R9 [  d' u- E, d  S$ p//速度(1-10)
. j+ j, z$ R) k# S" M) P( dvar marqueespeed=3* W. [0 T$ i: o: ^' |9 e
//背景颜色
) L2 |1 b2 z- \: t; t2 B9 _var marqueebgcolor="#FFFFFF"
: g( Q( f9 J# B//是否能暂停 (0=no. 1=yes)?' ~, n7 T2 w) c0 S4 Y: H
var pauseit=1# j' Q. c6 v8 a0 v! V5 h  I& z& ^, v

" q4 O$ c+ X5 k; @8 r: Y7 ~//修改显示内容( v5 u# {5 w: w  H/ m
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& R! P3 W7 F) V/ D9 W# U" t
8 L$ H( J  o* P9 `4 u: F  j
2 R5 e. I# x0 s* o4 C" ~& K! T- y
////下面不需改变////////////5 u& C! T* p+ ]; @0 V3 F
. ?+ I/ [  c( z4 F- M
var copyspeed=marqueespeed
8 s' Q; y) P2 X1 _. [# X2 ^# q7 d5 mvar pausespeed=(pauseit==0)? copyspeed: 0
0 ?) Q  j! _+ f9 d3 `( L7 D8 ovar iedom=document.all||document.getElementById
$ N8 c5 A) Y0 J' Bif (iedom)7 H/ F  U* c8 R" Q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')8 s: |2 j) e+ a1 L
var actualwidth=''
  h; G, D+ U1 Kvar cross_marquee, ns_marquee
- ^3 g4 `/ I2 b/ N0 o, b3 _5 w: c( [5 [* d
function populate(){4 w6 ], t0 p1 B+ R$ r  E& M- q7 A; ~
if (iedom){
' A7 Y) E7 ~, n9 Dcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* i8 s$ ]: k0 V" k' g& o* q  }' Tcross_marquee.style.left=marqueewidth+8' A2 R; x3 D& N& ?! Z4 A  W
cross_marquee.innerHTML=marqueecontent6 }$ Q7 h$ L" J" H* h* g0 v
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth$ \" B- v9 |/ ]# h7 L0 [2 X4 j
}  M  e" g; K$ |3 w% W2 k
else if (document.layers){" d; E& J4 j$ l+ a0 n. P
ns_marquee=document.ns_marquee.document.ns_marquee2$ }" s" X9 c: Z/ r
ns_marquee.left=marqueewidth+8% I7 L* a, s7 g: Q* i5 h
ns_marquee.document.write(marqueecontent)
) T" M7 c* Z! ]ns_marquee.document.close()1 H1 X6 E5 L8 p4 t- i8 Y/ f
actualwidth=ns_marquee.document.width6 _; ^0 |/ D! \1 [% a$ Z
}
2 Q; O1 o& H! Z3 c: @) }- B/ Q" ~5 ]' olefttime=setInterval("scrollmarquee()",20)
" p& ~) R% s7 C}
8 x9 G; J' o3 ?4 [window.onload=populate
, Y% _0 P: d& U6 T+ ~7 a: y* N& T5 d7 h: u4 ]1 _
function scrollmarquee(){+ {& m3 F( l, O: R6 I4 _- ~. D' G7 Y% z
if (iedom){% w' V7 z9 I6 Y! A% V% u- Z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))  d; a9 T9 Y2 R9 V! ~# r
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# _- ?% \2 |; {2 k0 R& Xelse% ^, b& r& b+ c2 \
cross_marquee.style.left=marqueewidth+8( I0 _, ?1 [* f
, K5 s( k; q) F: K5 l
}! Z( j( i4 [( ^
else if (document.layers){
5 {) P+ f- E4 y/ K1 P  ^if (ns_marquee.left>(actualwidth*(-1)+8))
  R6 I  m# x5 `; @# Dns_marquee.left-=copyspeed. t* r: r: g2 w
else5 V' j8 b" Q  B0 |5 S2 R* G
ns_marquee.left=marqueewidth+8
2 T( b+ a/ p, G4 E  k}2 D7 P4 H5 Z, T0 n( H
}
, v& p$ \# e4 f) r) ]
0 u& z1 x2 i6 d3 l; T2 y% f; f  Lif (iedom||document.layers){! i4 i5 ~, L9 L2 R' w
with (document){1 W) }0 N4 u  n2 @5 I# ^: H" l! d, t
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# Z5 ]; i/ M  Dif (iedom){0 N" Y9 t6 `2 Y/ j5 I
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')/ O3 b; b  p+ H( K# g
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ c$ N- h; ]7 O! Kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')  x/ `" ^4 w9 t) d" k/ G3 m* k4 B. q# }
write('</div>')
; U: S+ g' {" B6 d}
4 ^+ E, b% R; m6 v6 I- d# i/ M. Welse if (document.layers){
* Y# D' D+ A, a# h. ]4 Twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 _' |/ g7 m5 o- j; Uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 M) \  c2 Z6 y# ?  u; W8 x  [' l
write('</ilayer>')
4 \! N9 B+ m2 u8 w- C}
8 n& }5 k$ n& [5 w% u3 ddocument.write('</td></table>')
1 k7 {; V; G6 A* z7 [4 g}
4 n' [# i& J1 m6 y}: L# x  S- j4 s1 [& h0 ], p* S
</script>

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