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

|
网页之跑马灯文字特效
//修改宽度
% E2 v& x; a. h2 ~var marqueewidth=300
+ R% k3 _9 l% G f8 F//高度
" O8 g6 f; E" U4 {var marqueeheight=25
6 y0 N' x! j" A# L, A2 H//速度(1-10)
' B) B }: s0 {& g4 R; Tvar marqueespeed=3- n1 G" I( \0 r8 m; F2 s1 E* M
//背景颜色5 M8 _* D& F% j0 q4 I
var marqueebgcolor="#FFFFFF"
: |" A% n6 }* w9 X5 G//是否能暂停 (0=no. 1=yes)?
+ w! p1 I% T9 j) h# x: `% h+ ?var pauseit=1* |$ F- @: T+ S5 c# E
4 @+ X3 `" {2 W. B2 n6 b; c//修改显示内容8 i: I0 f/ p. d j/ l0 T
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': ` O# t3 Y! G
% K: i* C# G$ ?; M2 x1 T5 [6 g9 O- F$ ?: H! ?3 }! |: \
////下面不需改变////////////% ~* w \" L5 a# I% e) J7 @/ w
" P5 k! m Y* U; ~1 o4 c* I
var copyspeed=marqueespeed
: B: b- Q5 k. Y9 yvar pausespeed=(pauseit==0)? copyspeed: 0# c. a& K0 b$ ~: D9 _1 u
var iedom=document.all||document.getElementById6 m/ n; D3 a% P' P
if (iedom)6 H& a" f* {* F# V& f8 W' v3 d( p
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' S4 k9 f! I4 U5 n2 V- j. F) G2 n
var actualwidth=''
! O9 y* D7 R: l8 k. Rvar cross_marquee, ns_marquee
* l/ `% g; n. `3 D
( R# }: |! q+ N+ ~6 nfunction populate(){; _/ ~0 Z5 Z4 ?
if (iedom){; G" ^% }4 F0 l+ q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 U" u) g; w8 k2 U( Across_marquee.style.left=marqueewidth+8
- u* t% [# S" jcross_marquee.innerHTML=marqueecontent
* ?2 C; r" X! j2 j8 n6 F; d4 r% cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! W! m& N0 e0 B5 M X% H2 A6 K
}
3 K8 s/ T: A% xelse if (document.layers){9 b3 S Q. n4 p5 p2 h9 t: @0 j4 [
ns_marquee=document.ns_marquee.document.ns_marquee2
: {* P3 b e* c7 Lns_marquee.left=marqueewidth+8* |: g# Q, {! I
ns_marquee.document.write(marqueecontent)- t4 ]" p' ?* J: e( ]2 H. o
ns_marquee.document.close()
. ]: [4 x; ~. @, k6 S, }actualwidth=ns_marquee.document.width$ O0 I6 i1 b$ N
}
6 _' Q5 r9 z: \: Ulefttime=setInterval("scrollmarquee()",20)3 e, K; h' U# q1 K
}
3 ?, P4 `- m7 f! ~ `window.onload=populate8 E/ y' {4 G# R) n( _
% B0 o3 W# P3 X: y8 f$ J1 ufunction scrollmarquee(){. A& h' d K0 g: T
if (iedom){& z' S& J- l2 F% O- p6 X" M1 l( u
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 S. \2 ]/ G8 X0 _! ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! l3 Z4 F6 C/ [: Pelse, h0 M- ?0 l8 I4 J' @
cross_marquee.style.left=marqueewidth+8
. Z# a6 `* t( W) }5 t& c' J
0 Y- y$ J0 n3 J' D' a4 o}
) C2 X, E1 P( j& P; j3 qelse if (document.layers){
# D- e! T& x& y7 }1 kif (ns_marquee.left>(actualwidth*(-1)+8))# B @& U H0 m7 ~# V* `4 g
ns_marquee.left-=copyspeed. A% r/ V' w- t X
else$ ^+ V* f) C% d, X1 U7 i& x
ns_marquee.left=marqueewidth+8
, Y! L1 C; d$ l0 M8 n/ j2 X8 w}+ n6 Z, R \! E( C2 m, q7 b
}& g' P! {/ A) |7 U$ T6 ~7 x- O: k
9 ^# v6 V9 }2 K: u! f2 o
if (iedom||document.layers){0 M- l4 a; {. K: C5 O
with (document){ ?& ~) Y5 H, D3 ]2 v% U( H
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 D( t" b- w2 B0 F7 Iif (iedom){
% A3 ^1 S7 p9 O( V$ ]1 Ewrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( T/ o7 W2 }: u5 zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* V, t# z! s+ G- r) Z
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% z" }5 Q L: }4 g% \) s
write('</div>'). m/ r. r' _5 ~. E
}$ O% H- \) t; H% _2 v% f- i! B
else if (document.layers){* j2 V: i. P" _+ p- B8 M
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* R" `& j4 j, iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
4 A0 R; ^) t4 F+ r! Zwrite('</ilayer>')8 S3 ]4 ~! S8 G5 Q: K U
}5 h9 L, z7 n. p# j! D
document.write('</td></table>')9 P. |/ A, j% s0 l8 \+ P$ p- V
}
( c; ^. N* A0 M8 n}
* |% E2 I) a4 f6 b C! J S5 P" ~</script> |
|