返回列表 发帖

网页之跑马灯文字特效

//修改宽度
  ?, r5 _5 N. D5 Mvar marqueewidth=300$ o" n* ]% B2 d5 K. O$ H
//高度, Z, D/ X& J) e2 \
var marqueeheight=25) ^; Y6 d# M8 z( M* q, C+ m
//速度(1-10)
( a/ h! O, l( y" D1 @0 y5 rvar marqueespeed=3) Q, }2 ]0 _7 y) Y
//背景颜色" Z; b9 w4 p! J# z; t/ e3 l( m
var marqueebgcolor="#FFFFFF"
/ }" I! a+ i2 q: D7 m- R% s//是否能暂停 (0=no. 1=yes)?
( s9 Y& K+ ^5 `9 ~% }var pauseit=1
' F$ F( f' j: ^5 W4 i5 g
( d- o0 ^! J7 h2 K# \$ L1 `//修改显示内容
# {( h& R" a& Rvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. m2 J' n$ G4 w& ?  L, D2 z+ m: J# m/ u5 n: G' n

9 a3 M; `: z# S: K( ]% O////下面不需改变////////////$ d$ X0 p- a; \

( S; c6 G& J5 B  @var copyspeed=marqueespeed
' q% ^5 b* N& K0 Y/ N7 U+ @var pausespeed=(pauseit==0)? copyspeed: 0
. W8 M; A) n% K( {+ Ovar iedom=document.all||document.getElementById
2 B9 @1 p; x$ `( _* L- Pif (iedom)
- B, R3 f/ m6 R' idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 G! f& d. Z0 V2 U# Mvar actualwidth=''
; x" M# g# M8 x' [" Z3 [var cross_marquee, ns_marquee* V: }: @" G+ f$ ?/ J; \
+ F: e9 j: m# Q3 [& o2 v
function populate(){7 t' Z6 t; `9 h2 g7 |
if (iedom){/ {1 ?  e0 M+ k. Z% A2 s
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( ~( _# T, H. \9 o# l6 xcross_marquee.style.left=marqueewidth+86 H+ e0 r' N! B0 h* z% q' v
cross_marquee.innerHTML=marqueecontent
6 Z7 p# z0 M8 _" \, J1 L. c9 Hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! d8 S9 [- w! q
}: C3 }" `9 W/ \1 {& f
else if (document.layers){  n) ~6 b8 \; _' a
ns_marquee=document.ns_marquee.document.ns_marquee20 D& z. ?! P* _0 @1 o
ns_marquee.left=marqueewidth+8( [. N+ ]$ X; l* L& f
ns_marquee.document.write(marqueecontent). c! W0 o! I, N, f- S! z5 u
ns_marquee.document.close()0 m# e' ~% c7 l' F- }
actualwidth=ns_marquee.document.width0 U7 `8 L8 E) F! v! f
}
/ Z  V+ G/ U5 Olefttime=setInterval("scrollmarquee()",20)
# f8 c4 N0 W  S! }8 u4 J. m" y}
1 C1 L1 {/ `% p" |* R, v" jwindow.onload=populate
" ~5 [8 z* F, I- K# r
- J/ R; R% l+ [5 n" A# R0 qfunction scrollmarquee(){: m; Z' }7 y( p
if (iedom){0 T( @, p$ H  g' E& @* H
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 S/ Y; v; u2 R& [! u6 zcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: \. l# O0 |8 j8 k' g- P
else8 m. \) m3 L! f' i; s  f1 u) Q
cross_marquee.style.left=marqueewidth+8# G1 _0 c+ s5 C/ Z( {$ q

3 P- |" @- {8 D}
% V+ K2 g/ E9 I. n& g9 Gelse if (document.layers){
  R+ F* O; r' X/ Vif (ns_marquee.left>(actualwidth*(-1)+8))
3 m4 Y- I( ~% \; uns_marquee.left-=copyspeed1 }0 e% B2 v5 W! |+ V
else  D! P) t$ C/ C3 Z! g. F8 r
ns_marquee.left=marqueewidth+8
( S1 E8 V- K5 R( m5 R+ i0 R}
& r4 v( m$ l' R" Z3 u* z}% V3 E9 h3 [- A0 @6 r. |* J
3 W. e- r1 h6 d* ~# S
if (iedom||document.layers){
. R) i4 C2 ]1 n  y; L; Ewith (document){
4 i+ F- n8 V7 _+ Fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- |) A8 h1 o/ t' F% C
if (iedom){
$ O$ n* r0 o# r, p4 Swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 F" ~$ g. |/ N! d4 G
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 \$ v4 y  _4 M7 k7 V2 e/ _
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 E$ Y& @5 g, X9 W
write('</div>')4 T5 |3 k1 }& z$ Z" Z
}
9 c3 E7 W2 \. @6 m9 Welse if (document.layers){
3 [  X: h  v$ w' o  X2 Y1 [write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) ^2 W8 Z3 k6 T' U
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 s7 c* }2 |( e5 U
write('</ilayer>')
: ^& W% d  p) v" f8 }2 [}
6 X& M6 g! z6 l9 Y  M" ]document.write('</td></table>')$ ]9 o8 \, Z* i) e, G
}
4 o; g  Y0 Q: i7 K7 j! \}
, u( Q0 g; g4 t) Q& u( e6 ^5 X</script>

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