返回列表 发帖

网页之跑马灯文字特效

//修改宽度$ B+ K, ?) l+ e" c* ^( @! ^
var marqueewidth=3008 o9 h0 n) ]; \7 W. h2 `" t+ P) M
//高度
$ h" g$ r9 G! R' d! P" N" ?1 ^var marqueeheight=25* c/ X. F/ D. c; ]9 f
//速度(1-10)
8 C1 i  q4 S! Mvar marqueespeed=3/ S4 @: c8 R) e7 Z8 ?
//背景颜色
  b" |5 e( _7 K! m! n7 Gvar marqueebgcolor="#FFFFFF"
2 X# \* H  f: h/ o2 q; R1 h//是否能暂停 (0=no. 1=yes)?
2 m+ i3 H1 Z& C! x! m* F1 N* yvar pauseit=1
+ K) f* j  V( o8 Q1 _
  Y' }/ B6 F5 |2 d/ R/ u9 @3 p//修改显示内容
  q9 ~4 l* a: w* z6 ^) Svar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# g% M: A2 V3 a" o

* s+ k* R( T8 d! Y$ ?( G
( w# ]# n7 d2 ]1 b8 P. v////下面不需改变////////////  V) ~5 \" d2 N$ ]

# {+ Y1 o! e  wvar copyspeed=marqueespeed& F/ V2 I/ T) Z- i& V
var pausespeed=(pauseit==0)? copyspeed: 0. w- N3 z: p5 t# l' J& R5 k
var iedom=document.all||document.getElementById
" y5 a( B" e5 D0 W  ^/ \if (iedom)
4 v, v' f9 Y7 h# [6 I. b; x# Gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 b2 K' l) {3 |
var actualwidth=''6 w- j$ ?9 }  A2 }3 e. v
var cross_marquee, ns_marquee
4 e; o2 E2 c( y/ i4 f  A( ]9 {
0 }2 Y3 g# }9 I+ U9 dfunction populate(){9 r1 E7 i" G' q3 O
if (iedom){! n% S4 E# Q8 N# n# W
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- Q) U) M) G6 i# j
cross_marquee.style.left=marqueewidth+8
7 ^; k. u* q$ Q. V4 X; ecross_marquee.innerHTML=marqueecontent
7 t+ Z1 d3 h  @2 p% Dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; D- ~' P2 u3 a) X4 ~+ \. C* h}* H1 e4 k' ~/ l8 l3 y9 A  N1 y0 y/ b
else if (document.layers){: D9 i' G* ^7 D8 H! |
ns_marquee=document.ns_marquee.document.ns_marquee2
: J- {4 [5 V0 N) U, S/ H" Wns_marquee.left=marqueewidth+8
. l1 |3 v9 p$ @2 W, w- y& Q# Xns_marquee.document.write(marqueecontent)
9 @; e# }* H8 }, u- z& a0 gns_marquee.document.close()
9 x/ G; t3 x8 Lactualwidth=ns_marquee.document.width
& l) c$ y6 E1 o4 B}
. j4 W8 F" X8 `# U- K' Olefttime=setInterval("scrollmarquee()",20), y- ]6 Z. _* p3 [- I8 j& _. b
}
& U7 H: C3 G+ Z$ o' {window.onload=populate
- C# r4 A7 \! [% u
  X) l& f3 e, W1 ]4 s1 w% ufunction scrollmarquee(){6 Z+ z' A2 i& _
if (iedom){
3 w) U$ i/ H+ R4 T. ~( `. Jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))- v" L% b( l7 K9 y' \. R
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' n9 \0 D! ]& E
else9 t0 i! r! O& o3 j% ~& T
cross_marquee.style.left=marqueewidth+89 f/ w! \: S( Q' q

0 A' g4 {5 X* d- k# C}8 [* \4 c8 L! z' R
else if (document.layers){
$ m% R. k* H; n9 aif (ns_marquee.left>(actualwidth*(-1)+8))/ V, d  R( n6 l3 N  J2 m/ f( i
ns_marquee.left-=copyspeed! h5 [7 q" y1 v# @. C
else$ s+ Y6 I: r6 p$ C0 ~* l; s' h& e+ d$ C
ns_marquee.left=marqueewidth+8
9 P! _8 }; m$ i/ W( z( D3 G}
* l/ y& F) v' B% O}6 }9 [7 ?0 k8 A* f* W" v4 R0 q( B
+ s! y% C! o0 ~3 c  |0 {4 o, \
if (iedom||document.layers){
+ o- t8 S! }. a5 s7 P2 J4 \with (document){8 S6 F% V6 g( r5 N. p+ ]
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 q  [7 E1 n0 b7 H
if (iedom){
$ _; T- R% n& C& F1 r  O) owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 t! t1 A0 w6 _8 a8 S  ^* m; V  k+ o
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 m. V( S* F( W0 |2 B" O
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 a: z- ]% K. q' h
write('</div>')
% e0 a( t3 c+ I/ }# {# ]$ N}
  ~8 a* P2 x: T! ~1 {: |' u8 f* h/ ?  n2 ielse if (document.layers){
' d/ H7 b- U* k& y2 i, Hwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" v& u8 E4 b8 A. I
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; o# |) k; F8 D$ z: O0 j+ Bwrite('</ilayer>')
# ?# s# Y7 _* Y}  [9 H5 d* u) P# N) o
document.write('</td></table>')
: H; t0 b5 S/ V" g# L7 ]! W}
+ [; |: h% L2 t$ |" W}( G4 U. ^4 s& q! O7 L' g
</script>

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