返回列表 发帖

网页之跑马灯文字特效

//修改宽度# `' p$ a7 |& |: r# E% K: ~, j( @
var marqueewidth=300' j3 P6 L! V; r* V
//高度
7 G, |; K; @$ w/ W/ dvar marqueeheight=25' O. ]: A( y+ r) G5 l' u
//速度(1-10)1 d9 K; O1 U# l) \) u
var marqueespeed=3) z( R( S( Y2 D9 H/ V2 o
//背景颜色9 q4 [- g8 F  H+ @* ]! h+ O
var marqueebgcolor="#FFFFFF", N  C) |$ ]8 J. U1 i2 M0 D  o
//是否能暂停 (0=no. 1=yes)?
/ |3 t) u  q8 B& T1 dvar pauseit=1
: t- F4 w# i9 c% h7 `" D! S+ ]# j4 n6 V& W+ w, @( o
//修改显示内容, s+ k0 q* B7 {9 ~  S  ^
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 H- k% l7 F; |8 P* q) M1 R7 d1 y1 s9 ~. M( h3 D5 M

0 R& c4 U* @1 \0 z////下面不需改变////////////
9 Z3 K9 t4 {1 Y% [5 Y* l2 c: D# _' x( o. G" ~; ~' B: {( r
var copyspeed=marqueespeed1 Z7 \8 J7 V7 d1 n, d* y) u
var pausespeed=(pauseit==0)? copyspeed: 0! v1 r9 }( o7 r4 @
var iedom=document.all||document.getElementById
: ^5 y9 P  E* Uif (iedom)$ R% n* q% b* l4 N* K9 m- W
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')8 H% n$ t& ]4 O
var actualwidth=''5 i# Z5 i# p" ]/ {
var cross_marquee, ns_marquee  s- n! K' K% n  v1 J

' S0 M0 f  F2 f. e, W$ Zfunction populate(){$ N4 J/ @7 m2 |: ]$ U
if (iedom){! v7 [( _. v3 @+ @) x/ x
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# S* K& I, ?/ c$ m" l/ Gcross_marquee.style.left=marqueewidth+8
. z8 @1 o+ Q3 lcross_marquee.innerHTML=marqueecontent$ G) f. K7 z  [: C& ?) q2 Y
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- y6 T! v' s  W( |
}3 G# {. ]% A2 O
else if (document.layers){' M) x3 d2 f: ]3 y2 V+ q+ w5 ]% Q
ns_marquee=document.ns_marquee.document.ns_marquee22 K/ K$ F9 _3 K. ?( j8 y9 C1 l
ns_marquee.left=marqueewidth+8
+ W' Z+ G. ]  C4 Zns_marquee.document.write(marqueecontent)
( A6 P$ y: g: zns_marquee.document.close()
  |2 f' `/ n6 Z: e' }7 ~) c& Hactualwidth=ns_marquee.document.width+ L1 N7 r) D$ C# f: X
}
, G2 T! Q1 H* Xlefttime=setInterval("scrollmarquee()",20)
% C* V; t, m% V$ i}. ~! ]! V2 L' u; _% Z2 y! U3 A
window.onload=populate
! g+ Y$ K* K- y- R% a
( C  e# j. a: B; ]+ y$ E( n8 xfunction scrollmarquee(){
/ n# y9 H! v& B  A7 S& v( Rif (iedom){
3 e% ~4 D* l' d! k/ x* f2 u+ }  L/ }if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): o+ w+ G! o* Z5 `7 B7 q
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ N( a, H5 I$ a7 }0 v( R8 c$ }else; X  \! m5 Z) e% I' f$ u7 X1 g
cross_marquee.style.left=marqueewidth+8
% g8 `1 M6 S+ P7 b! d
4 i$ H6 F, r7 j; M. _- J+ c$ R}; t# t7 c+ E6 G0 V$ C" P
else if (document.layers){. }. D8 P/ L. J/ V. n# l; H
if (ns_marquee.left>(actualwidth*(-1)+8))& L/ `, U5 x: t4 b
ns_marquee.left-=copyspeed
, M7 x" c( K7 A; n' C2 Celse
# N4 F' ]! u- A% a1 ?& mns_marquee.left=marqueewidth+8
3 M2 ?% c8 {; l/ D; ]5 A6 X  |}
% g2 _" V! U# q0 K2 U( w}
  b1 u9 s$ p+ t3 B" x7 O- k6 {5 f5 K2 @( p# j$ _
if (iedom||document.layers){
7 L& ?/ ~+ ]  x  ~: M. _; F$ F/ gwith (document){! w' X  @2 C$ b3 n
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): R8 e0 E/ R4 s* n+ G) H" j: |0 i
if (iedom){
$ N# C1 f3 F3 E3 H: awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 u7 X, U8 H6 B5 }8 twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) I: y1 \6 K4 ^7 k+ c+ E' T( Y/ }
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 g4 Z. V* ?8 H
write('</div>')
: F7 e: c$ M: {' Q, e}! b/ L) n' h6 }" g
else if (document.layers){* k4 V& G& u$ r, P% F
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 t8 x0 B- E' }( Pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ W/ _/ Z3 ]# N. d, V  q
write('</ilayer>')7 f  `1 _# [1 ?% r3 h# k! M+ o
}
9 X$ M' n6 U$ `9 b' vdocument.write('</td></table>')
* ^  N% E8 v1 h* {" f}$ X  N1 H# W. Y( \( e- f
}
( O  Y& U% X  p7 T$ p+ |3 z</script>

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