返回列表 发帖

网页之跑马灯文字特效

//修改宽度  ~. s4 I0 w/ O$ Q& F
var marqueewidth=300
( d" e/ ^% X# ~) s. a0 K//高度
- U) P7 m' q6 Bvar marqueeheight=25
' s& \8 }# e6 S1 h1 m  \//速度(1-10)
. i- ~; z) E9 D& @* c( {. kvar marqueespeed=3
9 x9 S& f! ]5 ^' L//背景颜色- \; A! o) x7 Y1 ~, g: B5 o
var marqueebgcolor="#FFFFFF": Z+ Q: Q: O9 C$ m# h
//是否能暂停 (0=no. 1=yes)?; m1 ^0 N5 S0 s: _, y0 o
var pauseit=16 P* h) d3 M- ~8 {# G% p, G5 f

9 @, i  R7 d5 B1 B/ A//修改显示内容! c8 _2 u6 x; m& w2 f4 q5 B& I; a
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
  c- q6 c8 B' P. ]7 k
0 N2 V, h$ h. \( Q0 X0 }" W8 h: z5 B9 U# |& J7 i$ Z0 O
////下面不需改变////////////
& _! N4 G( {- l8 p( j) W4 i3 A  g/ r) q$ I7 x4 E+ @0 T- I$ x
var copyspeed=marqueespeed
- E* _9 C, L- `" ~6 x( x4 yvar pausespeed=(pauseit==0)? copyspeed: 01 _1 X" G2 y$ }
var iedom=document.all||document.getElementById
* @# Z( i) v5 g& Kif (iedom)/ S+ a1 k3 R& O: q! Z9 j
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), M" C- g- z6 a( s8 h! }
var actualwidth=''
/ m! ~! V# u9 p9 o, Dvar cross_marquee, ns_marquee' `. o. R/ D4 i2 ?" T) f: M
% N) _- X& d& G: r( e
function populate(){( C2 G' G' s( v  J5 q  C9 n8 @% `$ X
if (iedom){
" [' t$ V: [, m0 Mcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 Y% U0 e2 y$ Q  ]9 U7 a" H; ycross_marquee.style.left=marqueewidth+80 p5 A! a' H% N) H
cross_marquee.innerHTML=marqueecontent
& B0 ~, y( N  Q6 @$ [actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 _" q* V# Y6 F! t3 u4 t) E}0 m9 X5 _( j, z! X: |$ d9 X4 i
else if (document.layers){
7 e* c9 h, J' a) {ns_marquee=document.ns_marquee.document.ns_marquee2% U9 f2 p4 x9 D. D: f
ns_marquee.left=marqueewidth+89 f, z+ ~( w4 K' I2 b- I' s
ns_marquee.document.write(marqueecontent)
- P4 N& z( k4 `! K6 y. D! V% j& _ns_marquee.document.close(); x6 `9 X# ~6 l
actualwidth=ns_marquee.document.width5 i% J9 W2 v" D+ |3 @0 v0 a
}
+ D7 t' G* N2 ^' O9 }lefttime=setInterval("scrollmarquee()",20)) p9 F) G# }/ d7 }' I3 E3 }/ N6 M
}6 C' j5 @3 n8 A. g
window.onload=populate
, B+ O1 m8 b! ?$ M! ]" K0 d# W/ r
1 q# u5 q$ g9 `+ K1 h+ ~0 p; xfunction scrollmarquee(){# I& v$ P/ g% o1 X
if (iedom){
' V1 E) a% f6 h* P7 _$ V! Qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- `4 Q% }/ y' Vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! ?  T" |  ?" E3 W
else8 V3 C' x: @7 n
cross_marquee.style.left=marqueewidth+8
& A$ {+ P2 i% l/ C/ O3 B1 V, m7 f" B( P9 D' D* T; J# U1 P
}
  N4 C5 _$ i: H1 O4 {5 K# @else if (document.layers){+ N* |) l! i" r5 o9 M1 C
if (ns_marquee.left>(actualwidth*(-1)+8))
& B& U4 T# k: D' Sns_marquee.left-=copyspeed
( [" l1 p6 k: G  B7 velse
( E2 _0 W* M& Q/ b/ W) Rns_marquee.left=marqueewidth+8" o# R& }4 A7 C& @, q
}5 S6 v+ \: D& q* ]; g) M7 N
}! z4 v! K5 m9 z0 M* N

. T1 E  h6 L0 \1 i5 Aif (iedom||document.layers){8 ^* N; j5 H( p! R! Z) W" i- ?; \. U
with (document){
+ M1 c: X/ \$ Tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')4 K% s# ]" D. v5 T/ Y
if (iedom){2 [' p% c8 j' B$ A! `8 u
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 N$ f4 h/ E/ f' a% m( {
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 b! h. q  \6 u( L3 k* _) r4 P
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" v& G' j# G5 D/ c. H9 x3 Jwrite('</div>')
7 P( s8 v5 p( L% l. T! z- C! o3 a}. U& ^- q" R9 R; j3 x
else if (document.layers){
+ [+ ~3 g0 o! R! z' _% }7 P$ C: t% h: pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* k9 p5 g3 q5 e* M- x  g1 b1 Ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 ]- E) N# x6 Y. U3 U. b8 y
write('</ilayer>')1 l' p8 O$ l2 A: p5 ]# F. ]7 ~  t2 g
}
" Q! k$ \3 e( S  Sdocument.write('</td></table>'), K( q1 S; K0 r( a( J% E0 O8 d
}( d1 u3 T$ W" o
}
; h8 e' t) O3 _: \0 S3 V4 @</script>

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