返回列表 发帖

网页之跑马灯文字特效

//修改宽度' i5 q/ T) B* l$ {8 l
var marqueewidth=300
% C! w3 t; a  j& e//高度
  a* z" k& v7 R8 {* m8 q6 Mvar marqueeheight=25& J/ t+ ^% H) K8 a
//速度(1-10)6 x) A3 U5 q+ F- ?
var marqueespeed=3
0 u) i2 y% X9 k! H//背景颜色( O, t4 N6 O( h# F7 z* m  P% y+ Z+ o
var marqueebgcolor="#FFFFFF"# x6 j) X5 C4 R0 \* a
//是否能暂停 (0=no. 1=yes)?
& e* Z1 t. w- X: U. }* wvar pauseit=1& n3 i9 j4 Z+ ~( t1 [8 y
0 E% |) i! X% n6 ~1 o( }
//修改显示内容  o4 u# F; ~/ F- A# X  H
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- ~+ k; x  h; ~" b2 v
8 k- l1 N5 X. E& c
, T& E1 p9 m6 U2 F6 W) _$ Z- i
////下面不需改变////////////
3 m% P. l3 h/ d6 X: \  O  m# N
3 J% X* A& p0 V  h1 X5 ^1 W- V" ^% lvar copyspeed=marqueespeed3 }4 D# K, k7 F9 r
var pausespeed=(pauseit==0)? copyspeed: 0! M1 \* u/ t/ i! _4 p% {* a
var iedom=document.all||document.getElementById
. k6 f. Y. n  j- G2 M8 ?+ r, Aif (iedom)
! \. M0 K* {( K" Cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 ]; B1 }7 \  p5 `' O: r, o5 M+ x: T
var actualwidth=''
$ r( ]4 V; k6 G9 x! o9 Jvar cross_marquee, ns_marquee' U' p* G/ q3 F

) B9 |, l$ b# [& ^9 N, Sfunction populate(){
: `( n" L3 o) ^1 ~/ gif (iedom){
: f3 H- h5 Y% tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" J; V+ L' Y5 U! }, O
cross_marquee.style.left=marqueewidth+8
: _. ]' v( ?4 \2 n7 m  b# j! c' Wcross_marquee.innerHTML=marqueecontent
! y9 i# l$ q/ w1 uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: J7 H% S( t0 I7 x) h4 U
}6 D0 V' A7 n1 A% ?) E+ t# r2 @
else if (document.layers){
# c- u& Y, A0 x. G! X5 m: h3 Rns_marquee=document.ns_marquee.document.ns_marquee2$ {9 |' p7 [, |, ~+ D* g
ns_marquee.left=marqueewidth+8
$ ?. d' |7 p* ]7 S+ ins_marquee.document.write(marqueecontent)$ N4 D- O& G) _' a4 S; o9 ]* }
ns_marquee.document.close()6 F& R  r% S5 Q% _5 X8 t
actualwidth=ns_marquee.document.width# u7 `; R% K6 J* b3 l- u- P+ Q
}
9 J7 K1 _  @/ [7 C7 u. K- o$ clefttime=setInterval("scrollmarquee()",20)
2 a& r8 l6 `3 z}
6 E2 b# m2 G2 C) kwindow.onload=populate
( d& f; Q) C, j+ ~2 A5 L. F" F0 E+ N  B% {) f9 e  c7 i
function scrollmarquee(){
/ j  W) P. ]7 Q2 |if (iedom){# W, Q3 z# i  s5 v' p
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 }1 Q# @! _4 P0 s$ pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ Y) r0 z. [  f) S! o* F& P' H& h5 G, gelse& o5 Z+ N6 t, b) C; g
cross_marquee.style.left=marqueewidth+8
) ^: z5 m! F# B9 Y( f2 r: V$ ?/ F# l& h
}
% b/ U* y, y- e. s/ G" X# telse if (document.layers){, H5 A  O. j; a
if (ns_marquee.left>(actualwidth*(-1)+8))
& X( {+ J1 H8 bns_marquee.left-=copyspeed  V5 V: d9 a, M9 ^* M; @. A
else3 ^, v7 ]  P- x/ D1 _% H- L
ns_marquee.left=marqueewidth+8- x% @: U1 A; @) y8 b
}! I/ Z  Q2 r# u: m
}
8 o% ?7 Q) s" E8 a* D! X7 }0 A
2 f# f4 G9 [9 _. n+ ]) U3 yif (iedom||document.layers){+ V6 d- Z3 W) A- b, C
with (document){5 X$ L! C$ W/ b$ [1 {. k
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 F9 [7 }5 m0 j. V' R: T5 a! Mif (iedom){
# m- D  i3 z, c: |8 I( v4 ?+ wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 @! O0 ^8 u& i/ y" Lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 e( P! ?: |* i: t# J& i
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- V9 R( A( M" J4 t2 B
write('</div>')
  @$ @- R4 p& i2 i4 a}
3 {7 d2 @; f; helse if (document.layers){' p* d& {( p8 l% V/ d
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 N4 ?! W( J8 n: ?$ ~
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 a+ O! P, ?3 @, H3 u5 w) _write('</ilayer>')
; \" U! j% D4 [, s: e8 I- P& H}
0 t/ G  \9 p  E$ A5 ]* C7 ydocument.write('</td></table>')5 Y, c( T1 p+ b' _
}
* _% Z8 Q- e6 l) P% l% }}* Q9 M; |- u6 V) A' b
</script>

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