|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度
- e) r+ I! s( [5 S" `var marqueewidth=300 X6 M. L- q+ s( _) T( X, x1 d
//高度
( Q1 c- |6 a& X0 }8 u! P& V8 m. d* rvar marqueeheight=25
) ~7 z3 I: ]8 ~% M) H" I//速度(1-10)
0 B) N0 t+ k# ^. w _ G# z; mvar marqueespeed=3
Z: C2 G; {7 u& y+ @+ b4 X7 E//背景颜色
) j5 M4 h1 q+ |9 C, ivar marqueebgcolor="#FFFFFF"
' a; F# X/ P6 n% |7 D- V. C5 {1 `//是否能暂停 (0=no. 1=yes)?9 p& a" i# P6 `: q% \
var pauseit=15 {, [* d! ^! C6 r) n! d. f: ?: Q1 m
* l2 \; I, B* m' f: k* j& g, s
//修改显示内容& w/ |2 C, @% C7 Y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: |6 N$ z; @3 Z5 x) d- p) Q: D% h" n6 ]/ g- L
% M, l/ L I+ L+ }8 U////下面不需改变////////////8 Y; o; u" a. A8 R; C
. {% h* H* p; e7 xvar copyspeed=marqueespeed
+ V M. T8 C# z) p$ p' v7 _' }4 R1 bvar pausespeed=(pauseit==0)? copyspeed: 0
1 j/ B) z, _5 b/ b1 w4 Ivar iedom=document.all||document.getElementById3 r* y/ j4 @* x' Q
if (iedom)+ C& V- U+ e7 c7 ]( u( R
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 R% J3 [. L; B# w; z) r1 Z! Lvar actualwidth=''
! D+ M$ h2 _+ I4 Tvar cross_marquee, ns_marquee
! B' d! g+ T; }. y2 }9 o
# v, G) j/ o: t, i% F, D( A5 zfunction populate(){5 O5 p, ?, g8 r1 C! V0 |
if (iedom){
+ E0 x V4 ~. kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 g% p# i7 _# X- y5 Q9 Z9 h
cross_marquee.style.left=marqueewidth+85 |1 n" a2 E+ D$ `* o y0 F
cross_marquee.innerHTML=marqueecontent- W/ F, S& Q6 b8 J! c# H( H5 m
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 i2 f& }* Q/ @4 S. O) h# E1 \5 W
}
' d m- ?2 c" `) x; celse if (document.layers){! m" G5 W2 h. ~5 }% o; M! `6 ]4 O/ f" q
ns_marquee=document.ns_marquee.document.ns_marquee2' |2 F* S: Y- m6 R. M. |
ns_marquee.left=marqueewidth+8 x3 U2 S8 t# s2 F- {8 K
ns_marquee.document.write(marqueecontent)
1 k3 i! l5 \7 {/ D! ins_marquee.document.close()/ Z" j2 E0 v' v, r8 C
actualwidth=ns_marquee.document.width
$ o. H6 _5 L& w}
5 A6 Y9 e6 k$ }7 c: elefttime=setInterval("scrollmarquee()",20)8 \# A0 ^0 ~# {
}
/ H+ z3 t0 s9 G4 Swindow.onload=populate. L3 L5 J; p9 U' L6 n5 q. n2 t3 `
! z6 g @. O2 Ffunction scrollmarquee(){
. \: L" v) e2 R5 E9 r2 [if (iedom){
. Q% ]/ C# n6 N, f1 Zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
/ Q/ }0 |4 F/ z% B( W6 u6 C# Ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( N6 x+ L1 J6 ^% H* i
else8 k+ h% w0 {: Y! F, m
cross_marquee.style.left=marqueewidth+82 A3 d+ Y8 `: d
: `& t7 J% U8 W}3 H% P1 Q# o9 j4 I7 k: |5 u a4 G( w
else if (document.layers){4 e: A4 P5 M. X) J* y: ?3 ]
if (ns_marquee.left>(actualwidth*(-1)+8))6 A/ s, l* w$ L, @/ C
ns_marquee.left-=copyspeed
2 j& r& v$ J+ B/ ^else
/ ?9 }/ A2 ^! q/ j7 Nns_marquee.left=marqueewidth+8! P* J6 Z! j! p. _* \% f
}8 p2 i9 |8 V+ J) i* x9 \
}: p/ N( |/ f0 W/ V. P% D
4 U. C, b3 k) s# m
if (iedom||document.layers){1 Q F O& K( Z9 W5 z; Q
with (document){# ^/ U+ D2 `* w% u
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')1 n- a' X9 A0 u" p" k( E# O
if (iedom){8 I% S+ ]4 O Z9 |/ C& i1 q( a @
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' @+ Y/ ^% G# ^ P1 [
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
% G7 Z, k8 @( O+ x$ j% C* S* q4 Owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( Y7 A! c6 P* r& S
write('</div>'): P7 F, E. L5 z. b: W, _. E, Q
}
/ q; F! p8 G/ G+ Celse if (document.layers){( e1 M" f' ~6 ?% f- a! p. k
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% M/ z) [4 i. b9 f2 q% B( \write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! I# Z$ f* u( L% N. p7 B3 \3 Vwrite('</ilayer>')
3 I' q8 e# ]. e& Z. ~* e}1 X8 q3 m6 s0 ?5 H. J- s0 F6 r
document.write('</td></table>')
: Q0 c. H; I: ]/ @8 O. |$ @6 O}# A" f8 K8 Z2 ?" w
}6 V# X2 O- [; E0 M
</script> |
|