返回列表 发帖

网页之跑马灯文字特效

//修改宽度
! `9 b3 a( g  ^3 K* d' W, T& ?var marqueewidth=300
2 m5 S3 D9 U" s4 A6 p  @3 Q//高度$ z$ r* @( T/ O) E
var marqueeheight=25
4 w/ D' @' o( O4 I" B7 z//速度(1-10)& T6 c+ x5 I# d: e7 K
var marqueespeed=3
  J# Z( s0 \! p* \( ?0 @8 J- A//背景颜色
0 Y2 B; a1 c2 C& g3 C# Tvar marqueebgcolor="#FFFFFF"
6 e8 ?! \# o  P" i//是否能暂停 (0=no. 1=yes)?
  S/ ~2 t% Z5 Z# z( b3 F9 Hvar pauseit=1/ w- V% o- z1 K$ p; x3 X

0 e1 i% P5 h+ S//修改显示内容8 s8 U& X* M: e3 p, w
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# n5 |: q( ^  B! {% p4 w# L; Z/ z4 U& V; G

5 z& B  c; I( r% S8 T# G////下面不需改变////////////
7 C( G! }, b1 l2 \$ t; _+ z, f& N( ~6 K) ^2 P
var copyspeed=marqueespeed2 a* A' |4 f' |/ T$ a$ N7 J+ y  c
var pausespeed=(pauseit==0)? copyspeed: 0
3 o: U) O: @% ~* W: r3 s$ @var iedom=document.all||document.getElementById! B  }0 A, C$ R: n- G: E: y
if (iedom)3 v; l9 G. d. t* e
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')# m9 B" s& w2 _3 E+ B
var actualwidth=''( w4 C) X: S( X2 W# M8 G3 R
var cross_marquee, ns_marquee9 S2 Z; }+ R# h6 W

- {  Y3 `) a4 z" G! s: r9 h4 v9 cfunction populate(){
& i  y/ K; b, I$ D+ p2 Pif (iedom){
' y4 Z0 S5 `3 tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 N' w( y; f+ V( `$ Ocross_marquee.style.left=marqueewidth+8! t# ^% m# B' o/ l$ \
cross_marquee.innerHTML=marqueecontent
: T. g! l0 s( o  ~% _# \# a3 Jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ z9 p9 Q6 s6 B: Z+ r  F( ]1 C}
3 g  j# x. W. y; L! s1 L3 T0 Kelse if (document.layers){+ e4 J# j' n5 n' [8 L7 Z8 N
ns_marquee=document.ns_marquee.document.ns_marquee2
3 Y8 Y) c  ~% U4 Mns_marquee.left=marqueewidth+8
7 w/ _& i, Q5 U. yns_marquee.document.write(marqueecontent)
, q1 ]6 s/ _3 ~9 \ns_marquee.document.close()
) C: u+ ?- n  X! ~8 h7 iactualwidth=ns_marquee.document.width$ }9 ^- |8 p$ Q" r
}
/ s7 x1 [1 I* wlefttime=setInterval("scrollmarquee()",20)+ z; t" C: D# |. n# \" N1 u+ D
}, p/ I2 H- |/ t8 T
window.onload=populate
3 K3 B( N& q5 q# j. S# ]: `% ~* @
( ?; Z8 H% [" p8 r* H* b- ^function scrollmarquee(){
+ f4 t, M8 V8 dif (iedom){! p7 N$ S% T3 g- j
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 u. x2 L! o" K
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! k- }" z6 L  i# _4 ]
else' a8 Q& j; V  S# n# M7 k) X4 D1 ^% q2 ^
cross_marquee.style.left=marqueewidth+8/ _( a: k$ R6 {' k: A
* j* R0 F' Z) v$ l
}% u0 v7 s& k+ W6 H
else if (document.layers){
; _5 A8 H4 S# S" D' i3 J  Yif (ns_marquee.left>(actualwidth*(-1)+8))( @3 g7 {/ @. H/ ?- I$ f0 W- y
ns_marquee.left-=copyspeed
5 w: @! Z" @' U. @3 A/ `6 ~1 jelse3 B; G& y* l8 ]1 ], j& s
ns_marquee.left=marqueewidth+83 m" V1 f" ~% _8 G" J  p
}
8 j2 b9 ^. F  m6 U}
7 L( g# K, T* o6 G- h# y$ w' V  K: m5 W" T
if (iedom||document.layers){
( f1 E6 X5 S3 R. c' }+ p. @) G+ \with (document){: j  C- p1 D, U  q/ [& L3 J9 O* @
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 a& G2 I# P+ q) m8 Cif (iedom){
6 R/ s0 M+ e+ |: L' M" dwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, ]4 n- H. n; q6 N9 D8 V8 awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
3 A+ a0 p# G1 Ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" P# T7 Z; N, w# j9 W* M$ a4 ]write('</div>'); S! F/ D9 ^6 q9 M: y- W
}) F# w2 x4 v7 S% q+ H7 J( n; g6 Z
else if (document.layers){7 r. j5 V8 ~1 r4 V
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ }8 L: m. p7 E6 A* N* }: O: L
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): Q6 K4 S3 Q  \1 R
write('</ilayer>'). _1 z5 a5 G% A+ e2 C* @! Q
}( _3 N0 v" @5 V. u
document.write('</td></table>')
6 q% `/ X2 V$ P# I}( [* D( j0 J+ _/ v! P; u) f8 l3 {0 o
}7 C3 j5 ~3 J- `+ b2 c
</script>

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