返回列表 发帖

网页之跑马灯文字特效

//修改宽度
/ i- ~* T: R/ kvar marqueewidth=300* b8 A* e; V  W& A- l
//高度+ F6 H& h$ }2 g3 c8 t' A  l2 r) S
var marqueeheight=25) b" H5 L& G& U# n9 K
//速度(1-10)* z+ G& ^' x& G+ _
var marqueespeed=3
! p8 p# h3 \) Q//背景颜色
; Z5 n4 d4 c- M& kvar marqueebgcolor="#FFFFFF"
# l! N4 g  ?) d1 U& W! e: ^3 b//是否能暂停 (0=no. 1=yes)?
+ m9 D- j1 s: d+ yvar pauseit=1
7 s! w2 ]% D, a. V2 |
# s* E# z+ E  V+ z3 u. C5 T  L2 M//修改显示内容3 u$ {5 q% W* L
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'5 E0 |" y5 f$ S; G/ o
! M: _0 U1 U2 z" t

' ^6 q% m6 `4 d5 @5 \1 j////下面不需改变////////////
; ]3 [: Y. M; B* ~! Z: v4 d! |* q" U) h5 o
var copyspeed=marqueespeed
8 [6 i: I  d2 o6 M! ?4 tvar pausespeed=(pauseit==0)? copyspeed: 0
7 C* s5 [* m9 [. ~) @8 U* wvar iedom=document.all||document.getElementById
: a8 o# \6 i2 xif (iedom)( U% C/ H! w2 \/ n. e
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')( R) g2 |1 R6 i( ^# y' W
var actualwidth=''
* c* i. z+ G/ d; ?9 _var cross_marquee, ns_marquee
6 g: ^; V8 r$ y4 U8 w
- g# F6 C! I9 m4 G$ D9 n- q1 Gfunction populate(){
0 u$ _& Y7 K  ?if (iedom){% P% B: ~( Q4 L; f& y1 h) b* D
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' Z6 {7 `5 Z: e! |. Q; |
cross_marquee.style.left=marqueewidth+8
. m6 m0 I5 q- j( U+ ~5 U( Hcross_marquee.innerHTML=marqueecontent
* I  _, C1 l: x4 I( q; g$ I; P# Vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth1 t. p# ^6 R$ }1 }1 }2 a# D
}4 j; v& {( Z. A# M7 \* V4 t
else if (document.layers){; Y- D. ^' ?, C# \: B. {' Y8 T
ns_marquee=document.ns_marquee.document.ns_marquee2
1 o! R( c! h% z' z% ?4 ~ns_marquee.left=marqueewidth+8
4 y! @" d$ f/ E! U% Ins_marquee.document.write(marqueecontent)' _" \, k) x3 A3 a! n" W$ j
ns_marquee.document.close()6 \' U) h/ k; ?- i
actualwidth=ns_marquee.document.width
/ m) w  t1 |/ g: V}
: O$ q& q3 o" jlefttime=setInterval("scrollmarquee()",20)
/ M/ [$ V3 |. ]; p}7 m' @) C. ]/ w1 `+ N0 o4 Y4 k9 _
window.onload=populate1 E. G2 S, E5 a8 Q, {9 a
1 f# M9 a7 x, D& f0 c: N
function scrollmarquee(){) d% c* t6 M0 T5 k# b% o
if (iedom){) \  n7 ?- J7 ?( l2 i1 T+ O( l
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); ~! H7 c0 j! f5 Z7 }: [
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ ?, V, v8 k0 M- t" Eelse! r& G6 x; H$ F* W
cross_marquee.style.left=marqueewidth+8  y  \- B. T0 p  S, ?* Z+ S* x+ C7 H

5 N; i: s0 {; q: C( M}
0 x4 e- \* {* b6 g+ N9 O- Delse if (document.layers){, P: H& q: S: ~6 S. z
if (ns_marquee.left>(actualwidth*(-1)+8))
' F/ b# a, C- \- c' N3 ons_marquee.left-=copyspeed
6 V+ q) B) h' `% e1 B8 n+ ?else/ P3 Z- j& e8 j; ^+ ^
ns_marquee.left=marqueewidth+85 A8 g3 z) K4 }7 S+ Q9 u+ q
}& c/ t+ @5 Q% m7 B
}
) l; z. _* @8 L! g" T! e6 e& ]8 t+ R2 h5 M/ A( B& F, ~$ w1 x# h0 o  W
if (iedom||document.layers){
! T; p9 W( _5 u3 B5 [with (document){' |/ ~) H8 v) v6 S# D* ]
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 E: L$ Q: T" Z# _: P
if (iedom){( I; C' C4 l$ k3 q( D) u. z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 C, Q/ k  k" Q% ?; T
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 v7 T) ~' M. M5 o4 S; _
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 m9 A/ d0 y% \3 G& v) nwrite('</div>')3 R! ^5 P8 |- A' Y0 E0 V
}" ^# Q1 m* q5 D0 z6 H
else if (document.layers){
3 y' d$ w' Y3 Y/ h) Y, t* s; Y" C/ ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). `+ ~0 [. q: U
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" N5 I, l. H/ X
write('</ilayer>'): a# D8 S. y' O! U+ @# @& ]' I
}
& N( `7 @: M$ G* P" {* G+ kdocument.write('</td></table>')2 F+ t9 I) b( q4 B2 Q9 Q( ~- @
}
6 g* m' \: C) Q! A$ ^& ^+ A}1 N5 m: ~$ f  V( @) F. }
</script>

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