返回列表 发帖

网页之跑马灯文字特效

//修改宽度
8 W9 K2 R/ u( ~& E7 I- h8 Mvar marqueewidth=300. U- }& L1 |( \: x( ~
//高度, m) }) L+ Q: W/ h
var marqueeheight=25
; {) J3 D) q6 X* v, w//速度(1-10)
# s9 D( g4 O' Pvar marqueespeed=3
' ]3 }3 P0 E3 L3 ^5 t' h- q//背景颜色
+ z9 ~% O) |6 I2 l1 w9 Y! E1 Yvar marqueebgcolor="#FFFFFF"
( J+ k5 o0 ]) k3 I8 d//是否能暂停 (0=no. 1=yes)?
# M+ S% B2 h/ X% E5 ^var pauseit=1
; r# c& I; F/ j6 h: `* X3 T$ y
0 z" i9 K0 {( |/ O0 G) e//修改显示内容
' p# f# ?4 b; X. S6 M9 qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 n4 k) l4 [# s9 t1 p% q7 d0 h! F: C# u! _

7 w$ n' O: i  \. S) t////下面不需改变////////////5 R: e  n. ?  j3 d! {/ l3 X/ Q

4 u; {' F6 ~3 @& l' ^var copyspeed=marqueespeed
. u1 e6 z  z# Y. T  avar pausespeed=(pauseit==0)? copyspeed: 0
( |4 t. j, ]6 Q1 Z, qvar iedom=document.all||document.getElementById
# m# x/ s% m$ X4 \4 \; S1 Kif (iedom)
, [% e1 t) e, n1 x* M! ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
2 D6 n3 Q# |$ @# Mvar actualwidth=''
1 a0 P2 O+ g2 L. {2 m% Cvar cross_marquee, ns_marquee
9 p' \2 a0 l: w3 k& K9 }
. g3 t1 G, w! t" X' bfunction populate(){: ^% J. Y. N% ^. k+ o+ X; ]8 C
if (iedom){
- T; t! y8 G7 ^; V$ e+ ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" G& g9 i+ _6 a; U  a& j  S* J
cross_marquee.style.left=marqueewidth+8
* ?! ^) O9 ^, G0 gcross_marquee.innerHTML=marqueecontent
$ [, F1 V/ y4 H' Q! factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth1 x" E4 v8 t! Q$ u$ G3 U" z
}
/ I1 O* M0 g' relse if (document.layers){# I- X6 g" O; v; b8 ?$ b; T
ns_marquee=document.ns_marquee.document.ns_marquee2
2 }; n. b3 \. y* K" O" A3 rns_marquee.left=marqueewidth+8
" J' ~' o( T5 _; P% c2 `4 ]: dns_marquee.document.write(marqueecontent)) ?1 s/ g2 }* ?1 A. F- F2 R8 y
ns_marquee.document.close()
( [5 y2 _% H; ~/ ]% @actualwidth=ns_marquee.document.width
3 L! J3 D# W) A" |3 P$ v}0 [0 }' s* y3 \  S3 e1 m( |
lefttime=setInterval("scrollmarquee()",20)9 n4 O5 a- G; u$ k2 n' r' b
}+ _( U+ o, N& I
window.onload=populate
8 F  G3 G9 u+ Q% M; _( y$ A7 o
: E$ H( X/ q& D1 c: f6 ffunction scrollmarquee(){6 E- `) l6 r* j. l$ y$ A  d
if (iedom){6 ^1 e( O+ Y  `% s# Q8 c( @
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ |3 ~: a. Z: m- V" I6 F) rcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 [0 z0 x  L$ q% k/ I# m# E' ielse
! y8 m3 `0 }' L  E; Wcross_marquee.style.left=marqueewidth+8
# Y# ?# k. s/ n; e# C. f: @9 X
; ?( y* z5 z& U6 J: z}
+ b& Y) K% z2 Nelse if (document.layers){7 f' z- j5 G4 x" z! Z
if (ns_marquee.left>(actualwidth*(-1)+8))( s5 b- c) U  f( v0 N( u
ns_marquee.left-=copyspeed
; N9 r. j% g3 ~else
4 l7 V  r# P1 w0 }ns_marquee.left=marqueewidth+8/ X! W( |8 k: j1 d9 A1 w/ z2 ?; K
}2 j- M' T9 w- i4 O. i7 E# ]
}" s' {9 d7 U3 _% r9 d  T/ `! G7 H* Y
$ b" h% j  `5 Z  A, N* N
if (iedom||document.layers){
! d, p# J9 }+ D2 n3 B! [2 Kwith (document){9 r* G. ?, [! g
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 x/ N3 t0 a' z, [: l
if (iedom){9 m1 D$ V2 c: U4 }5 o- k7 p! d
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ h# A+ X# e7 W6 B( E8 ^write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, w2 w( O6 A/ r8 R$ [" S( Uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- J- O+ r1 I8 Z  I2 \write('</div>')% j9 Z, p7 @/ Y6 U2 F+ h4 w
}0 O- f; a: l' H; h
else if (document.layers){3 K3 C% k6 I. x. Z: N
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 a" U# w3 i* q8 ?4 G3 F$ Dwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( D& D7 i6 a8 r8 j' Z  E
write('</ilayer>')" A2 T& c5 w' b, B! w& p
}
. Z  ]0 R9 n) v( z% A7 r. xdocument.write('</td></table>')
* r7 k. P3 E6 Y4 {}+ Z& `# k2 Z( W; M* E' c: l
}
, @0 F. u. j5 Q& o- h6 j</script>

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