返回列表 发帖

网页之跑马灯文字特效

//修改宽度
1 j5 F2 m6 Z7 Z; ?2 Uvar marqueewidth=300
+ ~/ R5 Q, b7 E- b8 M( m* V, Y//高度
  |' g! O  M) Gvar marqueeheight=25# N9 h) u8 O! o9 F4 C9 P/ S6 a
//速度(1-10)1 v6 ~$ U( [. W" H/ ~0 U) n( y4 Y: o) F
var marqueespeed=3
: M3 ^" @  U/ j1 N//背景颜色
' s4 W/ L% a" Fvar marqueebgcolor="#FFFFFF"
6 @; [6 i9 j4 o6 {//是否能暂停 (0=no. 1=yes)?
2 R( n5 N9 N) t6 O6 K0 s% h% Qvar pauseit=1
+ R9 O6 m( ^  Z7 f% W$ \+ z3 X4 H$ A: I* n4 Q, K+ v* D2 v
//修改显示内容. z  o9 V8 q: S: z7 u! \
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! D0 a% z; Z) e* f. y; M2 d# I# m9 Z) B9 R; i

/ @8 I1 X! K3 Z1 f////下面不需改变////////////
& i0 f1 j) ^" O7 h* j- i; w, g, B9 q$ {7 x
var copyspeed=marqueespeed* e0 A" ]% P! b7 R
var pausespeed=(pauseit==0)? copyspeed: 0$ J+ b& N4 H1 Y! F7 H6 }( n! e$ V
var iedom=document.all||document.getElementById% d; Q, ~: _# g% e/ H7 M
if (iedom)
) T' z3 {7 J# Y2 T; t; Jdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). w# F& v9 f8 f# g
var actualwidth=''
( ?6 @3 M: b+ A/ l" vvar cross_marquee, ns_marquee5 S$ t. b7 t+ z' {- x7 T

+ I+ e5 E/ K6 R7 Dfunction populate(){( t& P/ Z$ \$ p9 x3 Q' ~$ I
if (iedom){& e) [3 ?# \/ g
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 X( o: k3 q+ U/ L% k
cross_marquee.style.left=marqueewidth+8
& h* I, p, n! K- n7 p8 dcross_marquee.innerHTML=marqueecontent* r6 r7 _, U$ ?( _
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth8 p% b7 W( J+ Z2 t7 V2 S
}+ G" G$ i/ `' B* R, Q. s  a3 g
else if (document.layers){
( d+ |/ q+ `+ o! zns_marquee=document.ns_marquee.document.ns_marquee20 O# o; I0 D  W% a
ns_marquee.left=marqueewidth+8$ R2 I  I0 I: [9 N
ns_marquee.document.write(marqueecontent)
9 S0 }) {# c- f0 Tns_marquee.document.close()
6 a) o5 G; L6 K8 W- p  k4 f  U6 Bactualwidth=ns_marquee.document.width- j) I7 B7 C* `/ s) E7 }, i
}6 [4 u3 L! B5 A/ s+ m& h: }5 i" z2 ^
lefttime=setInterval("scrollmarquee()",20)
8 X+ |7 u( m3 ~% `% j) s}" Y/ {! ?& Q# w8 z9 v( H6 O5 v
window.onload=populate
& D! {! h! `& W0 x, h3 w& D+ O
& Y+ w- H( c6 J' }6 E! g( q* pfunction scrollmarquee(){2 C- e' ?% W3 `$ _: |/ y; U
if (iedom){
4 ~1 u1 t3 d6 h/ z/ b1 e- xif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 Z7 z, |) l2 I1 h
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- y- S; d7 u5 Y
else
  D7 H% P! I& a: W9 y* `# W; ecross_marquee.style.left=marqueewidth+8
4 w/ O& U3 x! m/ K! g
. p* P# P5 ~6 _- Y) I; S}1 R, h( i5 D( l  l
else if (document.layers){( W/ p9 R% t. f% N1 s6 n+ [2 j  P/ R( k
if (ns_marquee.left>(actualwidth*(-1)+8))
; w1 a( l9 Z) G& B5 Ons_marquee.left-=copyspeed
7 a, _1 k- C& v4 s' b2 u8 Helse
8 a+ d3 z3 n3 ?! y) w: b' Zns_marquee.left=marqueewidth+8
+ v0 O  g3 ?# ~; ^; O}% N) Z" \& Q7 N4 n/ B& g0 z/ c" M
}* M5 E4 |/ W5 X6 @

/ O; V5 J. _: M# b7 D# R. \if (iedom||document.layers){
# _3 I2 D& B; i, x8 {7 U" u0 o+ F& lwith (document){- E3 A5 x, K# C2 m# {& ~1 ]& i
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')* a  B1 v: V1 `+ H, |/ x
if (iedom){
: q4 b6 G8 a2 R  xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ U  Q0 s5 l* _2 [0 }% {& |9 {& Cwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ o* i& B3 g; ]6 a" b( r4 Wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ w8 Z* A; Q2 X9 K8 E, ?# H6 F1 W& I
write('</div>')
4 y( [* ]6 N' o1 L}5 t$ {/ z4 ~2 t) _" x
else if (document.layers){1 a" X7 A- l( J1 N
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 Y2 B: }( B* C
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' q& H* v5 P1 W$ @
write('</ilayer>')( e! d- H! k) k0 k( V
}2 K( ], i0 x' z, f
document.write('</td></table>')
! k7 C9 G+ E! }$ a$ j7 @# B7 g}6 `3 u1 R- a7 m# b
}
: t) |8 g) _$ @* _0 z</script>

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