返回列表 发帖

网页之跑马灯文字特效

//修改宽度; y6 _) W) n3 K0 \2 ^. x
var marqueewidth=300
; ~' _- ?" F9 m5 v" [- n//高度
( I( w: F  ~' W' n) [2 {var marqueeheight=25% U2 K2 b: ^) l
//速度(1-10)
( H, h5 S+ _3 L8 I9 `! Kvar marqueespeed=31 C$ f, `7 N; {) x' }. J0 ]
//背景颜色5 `4 U) X& x# O/ [: I
var marqueebgcolor="#FFFFFF"
0 x6 ]* o; v& L& W. Z: g7 o) X//是否能暂停 (0=no. 1=yes)?; o4 }7 u: s. s: f2 w9 r( @
var pauseit=1  h) {1 N9 U; w2 s, `! T* `
% q8 y5 @, ?% Y
//修改显示内容7 a8 L4 O/ v1 F" G" h: e
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 V8 c# r( t# S8 T
' B* n$ t; M3 J' M

/ @& X4 z2 D- [( T' R) n, o7 U////下面不需改变////////////
, d& V( J0 N  g, U- h# `+ P" T
var copyspeed=marqueespeed% B, r' L0 V7 Z5 d! ?) \7 G( A+ f8 X" Z
var pausespeed=(pauseit==0)? copyspeed: 00 A0 M- }' x3 E( g( l/ y% ?9 T4 ]
var iedom=document.all||document.getElementById$ S. R" e" k0 q' }2 a
if (iedom)
! z) Y! V3 r5 [$ F0 }8 L, Kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 W+ r9 k* k$ S4 Dvar actualwidth=''' `6 U( D) j0 {* j5 E7 H+ v
var cross_marquee, ns_marquee4 L6 q* d; |. y$ P

' w3 f/ s& |9 P6 T1 {& nfunction populate(){
  P" {7 Z+ Y. }! L) B, Yif (iedom){7 s) S# ?1 ^, s0 u
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 p: a6 [$ q6 w4 G/ N8 vcross_marquee.style.left=marqueewidth+8) K. e/ p3 f+ M8 B5 v
cross_marquee.innerHTML=marqueecontent
! H- i- C( ^) ^1 i: nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. X# B$ j1 S! Q/ H
}
9 W5 p7 h, C' l, q% D# o+ T8 d" Belse if (document.layers){7 l; O! N3 y3 E! S) V$ x8 g
ns_marquee=document.ns_marquee.document.ns_marquee2* a' _: i1 I6 j; x
ns_marquee.left=marqueewidth+8/ U6 s& c8 l! c6 Y- l( S$ Z, y
ns_marquee.document.write(marqueecontent)
9 b1 z% R) |9 \9 k! k! \ns_marquee.document.close()) W; b8 @, r4 k, e" o- R+ ~1 E
actualwidth=ns_marquee.document.width- ?1 r- m/ L+ z# u
}
$ @" `) H5 k! u2 W/ _3 Tlefttime=setInterval("scrollmarquee()",20)% z% |# }7 `* {2 q5 L- l$ [
}
# \% \/ X; T& q% P8 N- D) P# bwindow.onload=populate, C6 Q; w( h/ v+ D5 L" R2 M

7 n: _1 a" y1 n- V7 [function scrollmarquee(){
2 u* j$ N* c2 _: y2 Cif (iedom){
$ L1 Q" X6 B7 o2 Gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 `8 L% S+ r, ~! Z3 w4 f: N
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 N, j! A) m; N' K# velse1 x5 v- `2 o& B4 Q
cross_marquee.style.left=marqueewidth+89 _( Q. _" J- d' C& B( j2 O5 q

5 V( |0 C4 P0 T$ Y1 U}9 N% a3 i3 \0 H; g4 C* }; C5 e, f
else if (document.layers){
3 C' J2 h; t: k5 x/ b" @; Y5 dif (ns_marquee.left>(actualwidth*(-1)+8))4 `  Z+ Q, c! W
ns_marquee.left-=copyspeed
0 i' R8 V$ e6 Y2 q. M8 Pelse" i# i% L3 I) [5 ^0 @( D# l
ns_marquee.left=marqueewidth+8
* U+ {3 q& g  \6 P( [& O}
6 I: a$ u  R% Z( y}
" |) m: H2 k1 |& i3 O
5 k) `9 e; c# L( p# w8 O4 Oif (iedom||document.layers){
( C- Z  F# [! x! Q3 G: l" lwith (document){6 _- B0 l- P! v. T! V
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 ~' X9 G( b/ ]' e  d9 o0 R
if (iedom){9 l6 ]- G# z$ r' \' H! v
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); |8 V, W; j( N8 t9 g
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 d( M, a2 ~: J* Xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 b* K; v( J) w
write('</div>')/ H: y( k* u* }7 n7 f
}% y2 ^' i5 n( @/ q5 Z7 ^+ f1 J
else if (document.layers){% ]- y+ V9 v) B
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). U' D5 \* w4 y& L1 K" K/ o
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 c% _, e: _; ?1 {* h$ n# [- d
write('</ilayer>')" W, }1 G3 n) p6 b& j, Y
}
! D3 [) ?. M2 L# [+ ^! h) D: fdocument.write('</td></table>')
* u( M' n1 [0 {( u1 ]}
) g% {7 p1 p' B0 g) e' p% j, p% d}' k% O0 q) x0 y
</script>

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