返回列表 发帖

网页之跑马灯文字特效

//修改宽度2 K3 g  p9 W  M6 Q, |! U& g
var marqueewidth=300
: t9 z8 i" v# t  _- N; A//高度
7 @3 w' s0 o7 f/ |# dvar marqueeheight=252 B+ y% q) `5 e7 {. t
//速度(1-10): y; H$ p9 ]( D$ X9 t: z  P$ z
var marqueespeed=30 A. w6 Q, W  _1 ?# S3 Q
//背景颜色  ?  h  j2 Z3 X8 w9 u; Z; T/ F! w
var marqueebgcolor="#FFFFFF"
  R2 |3 p) \+ u6 e3 k5 B8 h//是否能暂停 (0=no. 1=yes)?
$ V$ y7 f4 O& V' Z1 c3 l7 vvar pauseit=1; ]8 g* G& S  {8 n/ Z0 ~; {

+ t% a# w' B/ N5 G- |//修改显示内容7 b# j/ _6 O7 S: _/ H
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'  c( x4 `& b, D+ R. N( Y5 x  p6 e

# c0 x. z* V; k% ~0 K" o6 I3 ~$ c$ F! O( _  D
////下面不需改变////////////
5 ^% o' ~6 W, x8 J% s
6 p& h) }- z# c) W+ I1 j! d, p. Q. @; P/ uvar copyspeed=marqueespeed
) e/ \3 L+ w0 j; wvar pausespeed=(pauseit==0)? copyspeed: 0
3 r) p1 {9 }$ e- b: h; }) l( lvar iedom=document.all||document.getElementById
: K' y2 B/ d: k! V; J1 d+ p! }if (iedom)/ U' N% B; {  _" I! [" J5 C
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) E1 F( G. j$ o( i1 d6 |var actualwidth=''  X* \' b8 ]9 U, x+ l: y2 k
var cross_marquee, ns_marquee
- M# X1 R, x5 F' p
, Y- Y9 t1 H4 J0 w. R! A- ?function populate(){
! ^' t0 P  @( Vif (iedom){5 m- C) C1 q2 _- D
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ ?1 B3 q+ ~3 [: ~4 i$ pcross_marquee.style.left=marqueewidth+8( ]! R* f7 n, H8 w( A8 c" q6 A
cross_marquee.innerHTML=marqueecontent2 G5 p9 |5 S0 |: z# s7 I$ Q9 B
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; F% {, M6 j% c% v1 ?; n, c! p}
+ G" U4 f7 F# A0 R8 velse if (document.layers){  D* H$ A7 n& L! T" N
ns_marquee=document.ns_marquee.document.ns_marquee2
( s+ o8 l5 f, d4 I5 P( W8 rns_marquee.left=marqueewidth+8
' Y  m8 @( X0 Mns_marquee.document.write(marqueecontent)
( z8 C$ }) y( K- ]. n+ Y. a: Wns_marquee.document.close()
* N! I5 E/ @5 Oactualwidth=ns_marquee.document.width
/ }  v3 y  I" T0 z4 o- f5 K}
& f2 d' Q) ~2 d* w# h5 q9 [lefttime=setInterval("scrollmarquee()",20)
9 {( X) E5 E8 }}
1 D3 `" t( F/ |$ F8 E; ]% nwindow.onload=populate* s7 W% L. {9 z( Z* c, Q3 ~5 P
2 G* }' C" l  E+ W/ t
function scrollmarquee(){
+ }, K+ q. n( ^; P9 ?: Mif (iedom){% R; u! ~7 ^% p! M6 o. k) y: ]
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) a; i! G! o  R1 x8 O1 u; U5 ?cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' Q- d% k7 L$ K( }( P
else3 N  ^, I/ R' ?# Z
cross_marquee.style.left=marqueewidth+8
, O/ R  e9 b$ Z  K2 i/ m* n& u6 |! D$ h+ h8 F6 k
}2 y, s: b. D0 y3 @
else if (document.layers){* i& W8 ^9 L+ k7 B7 z7 Y
if (ns_marquee.left>(actualwidth*(-1)+8))' O* U: E2 ~  Y
ns_marquee.left-=copyspeed4 G  V: Y3 E) N
else" W+ @$ W2 @6 @
ns_marquee.left=marqueewidth+8, \8 y) X; p2 X4 @
}2 `; m+ \; K6 }$ D  ^
}, R: A* _, g' N) a! @" _
# Z6 J/ h: s- H1 i5 V2 T! v, h
if (iedom||document.layers){
, w8 _& o# i6 T  I8 G! H3 zwith (document){
6 C* B. ~4 j" l1 w; s  Xdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')1 V3 P2 m! W7 G! r" n  f& b
if (iedom){
5 x$ y! @* [7 {0 `write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 F8 |! }: F3 ]9 f3 S4 [write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 O6 [2 u4 _: ^, t! O8 x# Q: l  z% \
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 @& d! J  t' e/ o# o4 n
write('</div>')
: g0 V/ ~' C) J# h1 u7 a) s( y3 q- J: Q}; e9 u6 p  m$ u* l, k9 \2 W! ?
else if (document.layers){
7 s* @6 ~8 G, @9 I7 \0 Ewrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 @" w, p( c9 E; o- L6 l
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 n2 p  V7 R3 T% O+ Ewrite('</ilayer>')
+ P7 r' x/ w  m" t* Q3 U" T: N}( Z8 V/ j; D2 {/ o1 S
document.write('</td></table>')
5 z* ?8 Q% o$ U8 i7 l, x}
3 s; }' f) Q' O/ Z: m4 ~}
6 b9 p# u* }0 ~% |$ T8 f</script>

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