返回列表 发帖

网页之跑马灯文字特效

//修改宽度$ T  j4 L2 U1 V8 H
var marqueewidth=300
2 g  o, ~9 f6 U2 d' V//高度2 n8 Q3 L. C5 A. \; x) [
var marqueeheight=25
$ X0 N9 J4 C6 J3 l* t: ]//速度(1-10)
' U! o; l& _; W2 N0 j" R1 hvar marqueespeed=3
! d! K% e; g% p; U# o2 i//背景颜色: l! {. i6 l3 E0 j
var marqueebgcolor="#FFFFFF"
+ `$ k" K! M; ?( M/ b//是否能暂停 (0=no. 1=yes)?
9 W8 S4 G2 [# R/ Rvar pauseit=1
6 q" p& @8 f  I2 w0 H7 C- B1 u4 r/ a) E+ H8 w
//修改显示内容) }3 ]2 `( P1 d2 U4 J, ^+ H- H
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& {5 @5 b8 |* X) m* p5 y
5 }* r- M5 O# i5 T- H/ s' g
6 q. A$ p3 j6 @- a  g0 O////下面不需改变////////////
! w2 F2 b- Y: U3 E: a
3 j+ @% a, f0 r7 u6 M7 vvar copyspeed=marqueespeed
7 g) P* e* A- p$ i* d' A: rvar pausespeed=(pauseit==0)? copyspeed: 0
& w7 t3 |: Q3 H9 y" E6 C/ `. S& c& Uvar iedom=document.all||document.getElementById! l% O) K9 Y; R6 i0 G
if (iedom)
- s7 Q& `8 W5 c2 mdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 v7 G$ _' }9 Ivar actualwidth=''
2 M5 L2 P4 J2 H9 ~, wvar cross_marquee, ns_marquee* {9 |- e. n, v. t# e

! E+ \! I' C, d5 k$ {. L; f3 Lfunction populate(){" M, O& G# h* t
if (iedom){
( e9 l9 s& t4 {4 L% s+ Q) B+ Bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# x" e+ `# C+ y) X8 @3 i+ `
cross_marquee.style.left=marqueewidth+8. t+ v' ]* U2 |; j
cross_marquee.innerHTML=marqueecontent
5 C  _$ E% _# }" ~+ K( E0 oactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 X2 k$ T4 U( p. g. x! H0 v}
4 ~1 w1 x: G5 L5 ^- Velse if (document.layers){
3 q! f$ I$ t  k* Cns_marquee=document.ns_marquee.document.ns_marquee2
1 v+ @$ {) A! t- A+ }# Sns_marquee.left=marqueewidth+8' N3 v; P; _5 z6 r7 `1 F; e/ E# J
ns_marquee.document.write(marqueecontent)
, r5 N1 t  ]% K' ^. n( D4 ons_marquee.document.close()- c  [3 \* h: T  I' y  C
actualwidth=ns_marquee.document.width
0 x& }; D3 u' D; a}  [+ r$ w  c0 @% a  C' w% }6 S7 C7 B! f
lefttime=setInterval("scrollmarquee()",20)' N5 T; h5 t$ n( F+ _
}
2 R$ A( H7 v9 H' M. ]window.onload=populate
' i. [6 u6 R/ b6 G1 O2 s
) l3 z; u5 Y3 S- @function scrollmarquee(){
, D* @- {/ |4 `# F, V9 Rif (iedom){1 A7 p' x" S6 f' ~: ]) I+ c0 W7 \
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 Q# g. G  ^( ]' q9 x0 n% S/ y2 ^
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 u6 _" a0 S5 P4 K" jelse
/ e4 ~) B1 c1 D: c" d% @. ocross_marquee.style.left=marqueewidth+8
( p1 w* A+ R* m  m4 q. t9 W
7 U0 h/ {  ]2 R8 V  c8 L) b}
1 I& V3 s- t* \/ l; d+ @else if (document.layers){
6 M" M/ O3 a3 m. Q/ E4 n0 y, ?if (ns_marquee.left>(actualwidth*(-1)+8))
$ C- G" I4 R3 C. b! @ns_marquee.left-=copyspeed
6 e! ^- |. K& |2 Relse
$ F+ D# C; p! @ns_marquee.left=marqueewidth+85 N; N  O! N- H" U. ]" Y
}; G9 P% i  {$ V
}
3 f/ Z* t- x0 O! t: J% W
  x" s$ f- f) Bif (iedom||document.layers){
7 k3 O# o% _" t5 }with (document){
; N8 ~2 u) b7 _5 X- Xdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')$ n0 y- w6 C8 E
if (iedom){
; c0 {% s* H( N: I% m0 ], r8 \write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 A( [- u; [: S5 D: K# t
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
0 }5 {- @6 j. N' [' owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 b0 A7 F& |: @3 C; m) ]# m
write('</div>')
, B+ w2 @8 H4 Z4 d- q9 T6 y6 T3 l}: T. [$ N$ Y+ l: N2 B8 \
else if (document.layers){& {2 Q  x$ K* f9 B
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" _( S) a1 [1 Ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" B  S- Z% G6 [2 j0 j; Xwrite('</ilayer>')
, b$ h1 _8 s1 F+ {$ R% r* n}
) e2 I4 X1 Y) @: ^7 cdocument.write('</td></table>')
/ |8 R. _' a' c}
6 i6 A- ~" u+ ^! c) H$ t6 Y4 B}6 ?; @" s" X# G9 p" ]1 e$ D
</script>

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