返回列表 发帖

网页之跑马灯文字特效

//修改宽度
) z. o) q# Q6 g, B3 o: }: Nvar marqueewidth=300
( u# S5 [! \; V//高度
, e. B2 P( h* u% D8 d% Mvar marqueeheight=25
5 V  ]0 @, @# L( ^3 c9 p+ g8 |//速度(1-10)
) \% \6 J+ J6 H! Pvar marqueespeed=3
, L9 X1 M  k! Z* k; k8 `; B) z" }//背景颜色
7 G6 y9 y  }. Z. d8 B+ Qvar marqueebgcolor="#FFFFFF"
, l+ l* D" Q* I2 ^//是否能暂停 (0=no. 1=yes)?6 K6 ~; A5 Y  M$ V8 {3 U) f* j
var pauseit=1, A% K, ]4 W5 i% V
6 U, \& l) y9 F0 X
//修改显示内容* B  {: e' Q  X1 u1 V  v0 e
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 S, `7 o$ [( R
5 z2 x" T7 ]0 |' E
" `4 L  |7 r. F
////下面不需改变////////////" H# ~( [+ r; m& w' K( P0 c
& H$ w, v9 s  R6 U# [; G! ^
var copyspeed=marqueespeed
2 e8 r- K- D& i- o  ]var pausespeed=(pauseit==0)? copyspeed: 0
* C1 U# K* Y; Q& Z; D4 Gvar iedom=document.all||document.getElementById
! t- g/ Y1 O$ M! g1 O, {0 @- Sif (iedom)
. D) Y) c1 N9 b5 E7 zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 e, X9 L) [6 I1 f& g
var actualwidth=''3 f0 h' q* }' ~# q3 N, K
var cross_marquee, ns_marquee
& u. Z) f5 x- A1 F( j2 n% h$ r3 g8 R" ~7 C) l" ?8 D7 W& C
function populate(){" |' a* \2 T3 R
if (iedom){% x' E# S* Y2 `  d4 J/ S# i
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
" ~) _8 P. Q4 G+ \2 Scross_marquee.style.left=marqueewidth+8
6 `" T3 k  W! \3 icross_marquee.innerHTML=marqueecontent* _* [- p- K( `( u1 ~
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ C, q& t( b: o' T9 H! x* H}
, H; y2 }0 Y9 a9 @4 welse if (document.layers){5 D5 w1 i# j3 J0 @1 G
ns_marquee=document.ns_marquee.document.ns_marquee2+ Y& e7 O# i6 H; c) o4 p) h3 V
ns_marquee.left=marqueewidth+87 z- a8 e* ~" L, r* j4 H
ns_marquee.document.write(marqueecontent)4 E5 i- Y9 q$ V1 B4 ^
ns_marquee.document.close()
2 h+ K5 s8 ~( L( `" \+ \* {6 pactualwidth=ns_marquee.document.width; g4 k0 X2 q9 ?; @  G  l2 Q
}
- m) u" u9 T  c. A5 t/ z2 t$ f8 slefttime=setInterval("scrollmarquee()",20)# S  O/ s5 _+ n4 W. X5 g9 L
}3 d+ n* E6 n( i- H1 x' X
window.onload=populate' m. T6 X( e% u  W
9 }2 a5 K0 O& w* M, J
function scrollmarquee(){
1 K, I* [  E/ X( e9 G! Dif (iedom){
  t$ `! z% d5 O) d8 }  Q- l/ Z9 gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), {1 p+ u: Y( \: s0 G
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 k9 F' f. e! C1 T9 f& ielse" {7 B! y3 E" Q
cross_marquee.style.left=marqueewidth+8
: r7 E) Y6 i3 J. T  f- w/ W! u9 m2 D* S. L  A5 L/ M' r8 A
}, E" [( w$ T2 @# i. u1 q6 u% Z4 U! A
else if (document.layers){/ m! r1 j2 k" }
if (ns_marquee.left>(actualwidth*(-1)+8))7 n. u3 L% ?4 r6 e# K" B
ns_marquee.left-=copyspeed
, d  O0 b% i$ helse( \/ S" z! B7 e4 }! o2 n3 g& g# _" ?
ns_marquee.left=marqueewidth+8
  b; }+ D, M/ s. v7 y}% w/ ]8 f7 K9 T+ r$ }
}1 b# h/ j1 l/ l& O
2 p2 q& m" y8 H+ W0 K
if (iedom||document.layers){/ _7 h% {  q4 n' C: l% A+ z
with (document){: {+ G9 U: a$ {( i$ G9 e
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% P/ _9 s' z6 n% v
if (iedom){3 H. |, C' Z" R% R& K  f# t7 F
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% E- ]4 X' d( A3 q7 ~  Y# G& }2 f8 Z% H* w
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; ~/ O! V2 ^5 t; |4 Swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 b# w* e$ Z% q! J4 a+ Qwrite('</div>')' B+ O2 _: c8 B5 I) d+ [* t6 h$ f
}
+ J' {; \; l1 t7 D( ~) ]$ Pelse if (document.layers){& \! t# Z* y9 q9 B6 o7 C
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* ]3 ~" K$ x! T: d3 |8 \( k7 T
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( `; K" G" W7 ~. a4 k
write('</ilayer>')
0 [: n6 o  f( b- g6 t) F}
3 T. u% J2 Z  d9 q5 {document.write('</td></table>')9 E/ ]- M/ I! N, f4 e3 A7 _% A
}. b  J/ T& }5 p
}
3 n5 I, t* \4 T' f. b9 b</script>

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