返回列表 发帖

网页之跑马灯文字特效

//修改宽度
. t, ^: }! w( ^! J$ |var marqueewidth=3000 x: z7 A* s7 f0 X
//高度
2 e$ ], \0 X9 u& Qvar marqueeheight=25
7 ]# E6 X9 _" i% F3 d* o//速度(1-10)1 W" q+ m, v) V' `8 L. Y+ K5 r
var marqueespeed=36 |, J: S9 o4 D9 B$ @3 p
//背景颜色
7 M4 L& B% `+ v. {var marqueebgcolor="#FFFFFF"2 {. A* j2 `/ A- X; ~
//是否能暂停 (0=no. 1=yes)?/ w5 O; i9 |( G$ F
var pauseit=1, c5 w6 }1 a, k8 \- {& k, N

, Z' C& f6 l8 `/ |! A8 A( R//修改显示内容
" P- d, e$ T! Evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 F& H2 ^8 M0 B. w! u7 w2 J& T: }
* [3 A7 a, h; j; r0 u1 u0 u
4 C1 E) s7 F7 T9 H////下面不需改变////////////, _7 b* U/ `" @# P2 R4 J  L

! g" P' W/ q9 L8 q; A  N7 x; ]var copyspeed=marqueespeed" a  a3 O( L3 `* D' [3 Y
var pausespeed=(pauseit==0)? copyspeed: 0' P- w7 |3 q$ p; I# {" p
var iedom=document.all||document.getElementById' J/ e8 C8 D2 G: u
if (iedom)
9 }* A5 Y. a5 [$ ~9 Q. ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 Y" T# G5 v' a/ D3 N3 v6 J: U1 Kvar actualwidth=''
) _5 E- [. |+ n# M% ^% {. @var cross_marquee, ns_marquee
* S; N! i" E( x$ {1 q; k- O( y
6 @4 N" `4 Y5 gfunction populate(){
- t7 s4 ^8 e* t7 G  k3 B/ o+ yif (iedom){% D- O& s/ I8 L5 j
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 m; |* o$ T" i  s5 |& scross_marquee.style.left=marqueewidth+8' z# U+ b4 J: y1 O
cross_marquee.innerHTML=marqueecontent9 M/ P" B( _9 Q+ K+ N/ q& [4 a6 D8 |
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% C: Y9 @% C) K9 {/ P% h}$ w7 G$ k+ ]3 I6 z) T& i, y
else if (document.layers){2 m5 M9 p8 M5 h: f3 E# I, `2 S# S
ns_marquee=document.ns_marquee.document.ns_marquee2
6 y, A8 t% |1 F0 Hns_marquee.left=marqueewidth+8
* H4 ]% y: l' D7 g" M7 ons_marquee.document.write(marqueecontent)- N. L8 M- W# p. o( |
ns_marquee.document.close()
1 _. q' p7 ~# ]/ h7 R" `actualwidth=ns_marquee.document.width
" A' Y& R4 ~8 l4 V% N9 G9 P& E}
6 |. ^/ ]. W! d! Slefttime=setInterval("scrollmarquee()",20)
- u  ]: A7 z/ y5 s- G}7 l6 S# Q4 ]* W& ]; p
window.onload=populate
9 o! L/ X# b/ Q: J4 J
1 e7 I) Y4 K1 C; f  }2 ffunction scrollmarquee(){
& l8 J6 K# J/ Z0 f. B' c: x8 I" lif (iedom){$ I! c: z, ~' J; ~5 k  y3 r
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 t6 h2 r, X: F  R, jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. U* f! D- N& K' Y; e9 ?, i: J
else' ?4 `' N( D0 \+ ~
cross_marquee.style.left=marqueewidth+8
$ F7 K0 d6 j8 q8 o5 L. z; h3 _# k9 t
8 ]/ z4 a+ L/ u6 u1 o}
: k2 s- r, j5 ?& L" Nelse if (document.layers){$ ?5 `+ t& Q5 T  H
if (ns_marquee.left>(actualwidth*(-1)+8))
. [, \# C- j" |! F  I2 Mns_marquee.left-=copyspeed" o' Q4 L# |8 l3 J& A
else
1 |" K& n5 u) b7 \/ @% x2 d& z4 T% ins_marquee.left=marqueewidth+8
1 z& E3 o: R" c3 e}
) U8 a) J4 Z/ ]}
; ?: z* U, k9 M( A% n9 ?% q7 i0 l- G* \( i" X* b
if (iedom||document.layers){
# x8 m. B2 t' Jwith (document){% }* W- @- x! N4 s: q4 b5 R9 B
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 e0 ^+ d, S; x6 S) m7 m( l
if (iedom){
) p! H1 N& T$ H  R7 H# iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" m) q3 B% a* l- F. W% R/ I% c
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# m; e, \6 P# F
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* j8 J4 o, F# W  J5 h" }
write('</div>')- G" S* e: z3 G3 N. O
}
0 |7 E0 k1 y7 @: K5 x9 Welse if (document.layers){" S' q% F- R# A6 V& I
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. t1 v) f* R9 r7 s( d. {write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 f% `, S, v* T0 J  o0 j/ @
write('</ilayer>')+ u$ k5 S( n) h6 ?
}: }& y' ~( m4 \) A: J; y
document.write('</td></table>')
9 p9 ~  W% a6 _0 J$ e}4 V1 y3 R  w; S- G6 i/ ^: \
}
0 z9 P- U' u" J</script>

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