返回列表 发帖

网页之跑马灯文字特效

//修改宽度
9 l3 K+ ^. C# G9 A( o3 ]. avar marqueewidth=300
. d1 D1 ^# M8 a: ]4 q+ g, n//高度
4 V0 L4 o* C+ `" A1 P6 a( C) [var marqueeheight=25- o' H; H0 g$ T) m: Z3 ]; P
//速度(1-10)
8 |' ~6 J& n, Nvar marqueespeed=3
& _  B9 `* ?- x. W1 }9 X/ R0 A//背景颜色% Q% M; m" C" \
var marqueebgcolor="#FFFFFF"+ U0 ^9 `0 e/ O: B) `0 D9 Y4 O1 v
//是否能暂停 (0=no. 1=yes)?) @9 \8 Y: H7 e
var pauseit=16 p; Y1 E2 Y" L$ G  N: ]
8 z" T2 D' b, B2 H
//修改显示内容
9 C$ l" B& P0 o; R+ a" c& Uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
- s" \+ d% k: n4 x! f
" E! I% l' ^: r6 s
/ l& Y% Y- D7 Z////下面不需改变////////////
' R% ~3 i3 D0 ^7 I  _+ I" _( w! V% G$ s  |7 A  O  @6 y
var copyspeed=marqueespeed
/ W9 ~$ T# h$ f9 vvar pausespeed=(pauseit==0)? copyspeed: 0
7 d) G; f! B% I" Lvar iedom=document.all||document.getElementById
$ c8 l  R& t2 }7 i- A) yif (iedom)
& Z2 U+ z; s4 k2 {# u; tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% ?/ b8 V) @% a# {
var actualwidth=''" a: ]4 ]  @% j: _0 w, y8 `% P
var cross_marquee, ns_marquee
. G# }: f5 X9 l; n7 N
# I, ~9 E) o$ ?. w' G# rfunction populate(){
& d* r2 Z+ {) qif (iedom){
$ @9 }+ y; a, Q( s  O( {# Y9 @! Q  vcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 ]! Q! v; ^, T' ^' I3 Z' |
cross_marquee.style.left=marqueewidth+8
( ^( g. e- ]. M/ |cross_marquee.innerHTML=marqueecontent) Q7 ^7 ?( m3 d$ _$ s* |6 z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  C9 V# u3 ^0 c( ^+ D; q& r
}
' f8 a/ f" L, O$ \! Helse if (document.layers){  e; L$ T6 o6 Y" x7 D7 F
ns_marquee=document.ns_marquee.document.ns_marquee2; U( O& Q6 d4 }7 B$ n/ m
ns_marquee.left=marqueewidth+8( s* V& z6 x4 X( H+ N7 ]: D$ g
ns_marquee.document.write(marqueecontent)6 y2 T/ h% [, e( a. r
ns_marquee.document.close()- X$ A6 }1 x2 l+ I' o! y
actualwidth=ns_marquee.document.width
) H0 d% E- Y& l" R# a: Y9 U}
5 b- F" y+ {/ s; s9 N6 k/ qlefttime=setInterval("scrollmarquee()",20)9 r. x: R  f# u) J
}
' K- x% k4 J. L8 j" b* [window.onload=populate9 E8 N( n" C% u

+ s: C. `. I1 c' l( pfunction scrollmarquee(){9 r& |$ z, J4 E) Q, p% r: U
if (iedom){
0 X, U! ?& W$ m1 V0 K' Y  h' Vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 U& D+ p! |( s
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* W/ [2 O* e& F. Zelse
9 S8 M; m/ U$ }( O% o4 Dcross_marquee.style.left=marqueewidth+8
& g9 h. s7 m; M6 |# [2 [% x9 k  j$ \: {( s
}: O  m2 \; N2 d) n3 ?7 r
else if (document.layers){1 D) g7 f; u: K; m- g& U
if (ns_marquee.left>(actualwidth*(-1)+8))2 m! q% U& e: ?
ns_marquee.left-=copyspeed
: f( s9 B. ]# A6 Selse" L) V! B1 L5 {1 I
ns_marquee.left=marqueewidth+8
9 w. J; j& V- q3 q; W+ Z/ H}4 ]$ _- Q! Q6 s5 M$ v! m! K$ u
}6 |: ?6 F/ i* u6 _7 A

$ [4 m# e" t  D, G; k1 Aif (iedom||document.layers){
6 W4 }6 Y6 C0 e) q. \with (document){
; y/ Z. Q  ~3 @document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. ~  w# k1 {2 n7 sif (iedom){5 @- H* k. V1 M! ^
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 \) n* y: s! M) K0 j  H" p6 x
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 F* O2 n9 ?" h9 i
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( R) K0 N1 x. R2 A; P
write('</div>')
3 u' N: U& j2 T+ M6 P}9 o3 G4 z( R. y; y) n& h  A3 C
else if (document.layers){
. l; P  n. |* c6 M* X% Vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( [% ^: `4 S' A7 C" d9 d
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 @( `0 D, q% x- M8 E3 Q! I" X- jwrite('</ilayer>')
  z3 D! f' H6 C}
0 c: u4 I% k: \; [/ j  a& `document.write('</td></table>')
6 f2 u- z9 h+ u# y; y/ T/ L/ D}- W4 k) C* T  V8 Q
}
5 U) H) T: {7 t- p0 Z</script>

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