返回列表 发帖

网页之跑马灯文字特效

//修改宽度
( Z' K- R% m7 p+ Z2 m5 r) uvar marqueewidth=300
; K. y* V8 q7 C& Z: L, R7 i//高度
+ \( ^5 G3 ^2 c2 K* gvar marqueeheight=25
/ d  u" p9 B) @' ]3 m" m, }//速度(1-10), z% R4 R7 r0 Q+ m$ b3 L) p
var marqueespeed=3
& \& e" x! ^8 G; U- ^+ O//背景颜色/ n1 y3 ~- Y4 ?% f
var marqueebgcolor="#FFFFFF"9 Y) ^) G3 R) Q! B
//是否能暂停 (0=no. 1=yes)?8 y1 I! t1 s$ J% B$ X
var pauseit=1
& M! ?3 p4 ?) l" V3 X1 t
/ y; Z+ o; Y9 ~" z* N! T//修改显示内容
4 a* l: c8 {4 D3 Z7 \, x; N9 X  Yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 i  S' M: z0 c" Y/ |  j5 n7 {4 q
& Q2 h$ R% j# [; o! C4 x1 V
/ e: ^9 k' A& h
////下面不需改变////////////
2 W  n2 P. j1 @9 H* S: ^
# b! ^. W7 b5 c6 evar copyspeed=marqueespeed
) B, X) l7 N2 V0 B* K1 dvar pausespeed=(pauseit==0)? copyspeed: 0# c% i3 U+ a# o( Y
var iedom=document.all||document.getElementById
" C- ~2 p) V$ m8 o/ }" Z6 |if (iedom)& V- h5 R; `) n. P5 |
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
! o0 Y4 ~  ~; Svar actualwidth=''
, a6 \- k) V: ~4 Y, F( M6 Fvar cross_marquee, ns_marquee( N$ n/ r7 @* h- {$ S

+ C5 m, L- s( t) W' _: }6 H4 Gfunction populate(){9 J5 ~, r5 J% s% n4 N
if (iedom){" l1 i8 C+ o! @2 x
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
" d7 T' `% k- i/ r& V- \0 ccross_marquee.style.left=marqueewidth+8% F( F1 B/ x5 [+ B+ u" a; u
cross_marquee.innerHTML=marqueecontent5 s+ b3 ]7 n/ A9 v+ Y6 c
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. {" s6 U  d( a0 O}3 t* B" p& ?3 p8 Y2 Q' r
else if (document.layers){2 N$ N8 @$ R' ~
ns_marquee=document.ns_marquee.document.ns_marquee2
0 o: N6 D- U( Y& c0 ~' v/ Mns_marquee.left=marqueewidth+8. U! L% _4 W# _
ns_marquee.document.write(marqueecontent)( E2 f9 K, @/ b* L+ n
ns_marquee.document.close()# x4 h/ L' O- B+ _
actualwidth=ns_marquee.document.width
/ d" V1 W! s) T}
- Y' G0 h4 t6 B: N' ~; ^lefttime=setInterval("scrollmarquee()",20)
- Z3 ~+ e# W' n3 P}
. P& G- p) E+ R# b- ywindow.onload=populate6 o, r$ k0 X  @5 L$ c7 c" ^

: P& |  ]" T* N6 r8 }function scrollmarquee(){# j5 D. ~+ s% t& _  `
if (iedom){
, X/ k+ r/ s6 r+ B+ [. |# B& mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
7 t; W8 ^9 J  _4 Z2 t% \cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ w  G. A1 b$ x$ felse
: k/ g% F# q* u2 b. g" R2 s" K) e  ocross_marquee.style.left=marqueewidth+8
+ i) j% d- K" ]7 W0 t: u4 d. ]7 X& t
}! \5 M' n( G' Z  e6 E. r& |2 d
else if (document.layers){
1 o, r2 ~$ V, ]7 `! T; w8 qif (ns_marquee.left>(actualwidth*(-1)+8))# v5 i* L0 x7 j  C5 {5 K( b( }
ns_marquee.left-=copyspeed# C# B3 H7 Z* M+ B
else
1 a; i7 N; x- S$ _7 ^0 I1 u" G3 ons_marquee.left=marqueewidth+8
; k4 [- U3 Y+ B; i3 B; v: V}
5 h' P0 Z/ F* @6 m5 j  x}
9 t9 e# U4 b- {3 I* z# e) ?0 s& X+ H$ r! `) r6 T- Q
if (iedom||document.layers){! F5 U, V" M  s
with (document){
; C/ v* `/ O, adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 t* k* r- W. V; N- Lif (iedom){
( G5 P8 x! ?3 C$ [. C' \" owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ ]3 ^" A/ C8 I7 }1 }write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ \6 \/ u- j# q+ n& I( g- B( ]
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 U( {+ P4 k4 p  ^) jwrite('</div>')% P5 k: v; b3 T, W) t; c- _
}# y& s- w( Y3 x0 s
else if (document.layers){
3 }( g, ~' Q! `write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')0 T& e8 l# x) C2 j6 T" g- y' R
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' E! h( o9 s/ A7 d7 ewrite('</ilayer>')
( g) l3 u/ c" R8 r. `' x" m+ O}
, S( h+ p2 e& z- a) y. c4 gdocument.write('</td></table>')
0 }: B. `5 i: a}* {1 s2 Y  @) c6 D! a
}: x; T. X8 }# D; D" d/ G+ A. Q- B
</script>

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