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

|
网页之跑马灯文字特效
//修改宽度8 b o% r# c b2 H. S8 _
var marqueewidth=300
?; Y. M& o3 g6 H//高度 u, j. ?& ^- c: Z3 [) {* n6 X
var marqueeheight=25
. G' k' R/ j: G9 t( p: z//速度(1-10)- l! q' u. w0 y! V3 N2 g
var marqueespeed=3
1 r e* A( R6 s$ L0 p: b" @$ \# @//背景颜色
6 T% p. V4 \# ]% \2 `3 J- Jvar marqueebgcolor="#FFFFFF"4 D9 n: w: }6 f5 z6 y) A) |* I5 ]
//是否能暂停 (0=no. 1=yes)?7 A7 R0 U% u, l2 G- z$ M; v
var pauseit=1$ S5 z- p# T' O' o' `" ]/ r$ \
! ?! _: i( B" g$ D: F) y* K# E: ^//修改显示内容) M6 T5 T H' g& c
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': ] p" V1 E- p' s5 }0 N
+ M, e( j4 q$ ?* T) _) M( H
) O, D. v7 O) x0 R; x0 e
////下面不需改变////////////# Z8 ]3 y& m0 [/ { Y3 z' _
8 |9 F7 F& `! H; Y1 x3 X$ h
var copyspeed=marqueespeed
; [ K0 f# y% j4 f: t7 nvar pausespeed=(pauseit==0)? copyspeed: 0
5 \ \# d; S6 S! F( dvar iedom=document.all||document.getElementById$ I3 y8 J! ]6 W( G5 }
if (iedom)1 m7 P! E! C7 I: u$ F5 h
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 ~$ f. ?# x8 m0 |$ ivar actualwidth=''/ i2 F4 T" H* {7 U5 j8 T
var cross_marquee, ns_marquee
4 w' j5 b( V! q+ j+ A7 W: K1 R' F! G8 L) O
function populate(){: ?: X4 _7 @0 X
if (iedom){7 j/ w: Q( S' B& X8 U% w
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. g: w5 g. o Z' J/ U% b$ _
cross_marquee.style.left=marqueewidth+8
. c6 t, s( K6 J" W& y: f( Ycross_marquee.innerHTML=marqueecontent* P+ I8 l7 F! {5 V6 r- X
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; T" c! j) U1 n/ S/ O5 s" p; O0 }
}& I/ o V5 Z5 T7 w# }; ^- C" \( b2 o
else if (document.layers){( z8 u& q. {; J6 d, b5 o
ns_marquee=document.ns_marquee.document.ns_marquee2
9 |: r6 v; b- A, yns_marquee.left=marqueewidth+8
" F' b/ e2 V! _& dns_marquee.document.write(marqueecontent)
Y5 e# y& Q/ G6 C0 bns_marquee.document.close()
* H: X: O7 _7 H: nactualwidth=ns_marquee.document.width% T# ~5 W: J o8 L
}5 G9 N- k/ x% I/ I
lefttime=setInterval("scrollmarquee()",20)
$ p9 v) @; ]; ?2 v; e" e3 G6 x: k3 N}) r( b( E3 {, z! F
window.onload=populate! {7 ?, r" R; b i' B( G) Q1 U
" j% o6 ?. p4 y! a6 zfunction scrollmarquee(){8 v' p9 k' M& n' [. }1 m2 V" _
if (iedom){' ?2 ?/ P( \/ X5 t
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): ?. z2 z1 H* O/ E8 m, t
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 a* K" Z( Y" X# H" \else
5 C0 O6 U- o% D' n3 A7 ? v; V- ?cross_marquee.style.left=marqueewidth+83 m/ m. Q$ v9 ~
9 L& Y! P9 K' ?+ g! F}; W$ e* q6 G. Y+ _
else if (document.layers){
. w+ S0 t2 H a) mif (ns_marquee.left>(actualwidth*(-1)+8))$ k; y9 n& O7 S# x; I
ns_marquee.left-=copyspeed
6 e8 v6 g h+ \, U' X1 S7 I7 belse& N7 _, p) g1 s: ?3 Q3 c
ns_marquee.left=marqueewidth+8
, [3 u4 j( S% `- X% \$ l' a& q% `}
& c0 h3 O5 U4 ~+ P- D1 ], \}
, u8 g, a+ S- q; O7 ?8 V# \% z, {6 P: `7 W
if (iedom||document.layers){' ~' X+ \; I5 V& l/ b
with (document){$ z; r W8 d! `3 x4 T2 }8 Y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) a5 J% s! z3 e' ]- f
if (iedom){
% t- A6 R2 \! Q T# Xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): y% S" _* [. P7 T" j& M1 I
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 R5 L* s1 F4 L3 U# e
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 |7 ~# b5 Y9 F& T) |! u
write('</div>'). M* H$ K1 ^4 ~; Y5 J" F# s* x. R
}
8 b7 i" z* r8 Pelse if (document.layers){' D' o- }) T7 F2 }
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 M, X z$ k C0 \3 nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 h' E. u7 P3 j7 w4 D3 uwrite('</ilayer>')+ s$ t$ Y6 U! E0 t9 [, r
}
; H. \% c6 E. E4 D- qdocument.write('</td></table>')4 h5 z7 z; [& L7 v+ I7 |
}
9 p9 ?) C6 w( _} ]" y1 p2 [( |( T
</script> |
|