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

|
网页之跑马灯文字特效
//修改宽度
' K) x; b2 m" O4 T* ovar marqueewidth=300" [& J) Z9 F; f8 F' f) ?2 o! g
//高度
, O2 J3 m# b) @! g0 }) Rvar marqueeheight=25# w+ l" T5 a7 p; |& ? {! e
//速度(1-10)
. }0 F6 O5 L: F* f" |var marqueespeed=3
6 `) }3 U1 L% M( \//背景颜色5 y/ m" R4 ?6 h. s
var marqueebgcolor="#FFFFFF"
& n, e8 P' ~" z! R//是否能暂停 (0=no. 1=yes)?
& m7 U! g2 J8 Dvar pauseit=1% l3 m# i |- s9 o2 n& r
( z- f! Q& [: ?9 B' t! D0 S# v//修改显示内容4 j. A# y; l0 E2 |
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! ~% a \! V. V5 R+ x1 r! h$ \- o
0 \& D! U9 G$ U& {////下面不需改变////////////5 G5 H2 i! ~! _
# b3 H7 t# D+ J; R6 B, Q
var copyspeed=marqueespeed3 t f# }" `2 _6 z' p; j. n! S7 G
var pausespeed=(pauseit==0)? copyspeed: 0
- p6 B( \2 k& j* k3 Mvar iedom=document.all||document.getElementById* _3 c6 K8 ?$ o& n. v
if (iedom)
# }: ?+ w- P( x. {- I8 g( kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 e# V& @, X$ E4 G' p
var actualwidth=''
" `8 s. v8 {1 s9 [4 w, Cvar cross_marquee, ns_marquee
. f6 x6 V6 C2 b6 n8 y1 V* G: n8 H4 o D) I# I ?/ A; |
function populate(){9 e( U2 O/ a$ O* }, Z5 t
if (iedom){3 A3 p& [5 M3 C1 f: I
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ B! {3 |7 p8 W) T; F% p
cross_marquee.style.left=marqueewidth+8
3 F5 R: o9 o V0 c( c+ f0 @6 Zcross_marquee.innerHTML=marqueecontent
% K" c t0 D9 A( D7 i; ^actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( E! @$ s4 ~8 C. v3 q) z$ n}6 \2 }- ?6 N7 C
else if (document.layers){
6 H& u# I7 D6 |) K* \ns_marquee=document.ns_marquee.document.ns_marquee2! o4 x% r3 i+ X. a6 K+ a9 k
ns_marquee.left=marqueewidth+8. g4 u% p/ d, Y9 f, d3 { ~# ~
ns_marquee.document.write(marqueecontent)
2 S- h/ M5 N' k. c- N8 zns_marquee.document.close()
' l' }. `% }2 M( A5 \: Q" Tactualwidth=ns_marquee.document.width; |' B% u* X7 S+ Q
}9 J5 I) w# N5 }) _3 }6 c8 C
lefttime=setInterval("scrollmarquee()",20)" M' |4 c, f/ ?9 R5 x. u9 K
}- S, y8 ^7 d" }8 t, V
window.onload=populate4 p9 C& T) _6 c% k$ @; N9 w- X- b
/ x3 |, }$ l! p0 kfunction scrollmarquee(){
$ Y/ N# \$ \3 V2 ^if (iedom){3 F3 q) l$ ~% b( e
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 X# T5 p+ S% A+ dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" @+ A3 {9 H4 D+ D; X
else
- b7 Q) F4 |) K$ `$ X6 lcross_marquee.style.left=marqueewidth+8
3 f: A5 X; Z! d
) ?$ ~; ]0 R* h$ t: h}
( Y" r* K& K7 D' d9 @. b6 d' P. selse if (document.layers){" o' f) N/ ]0 x1 n
if (ns_marquee.left>(actualwidth*(-1)+8))
5 [4 ]. e8 o1 Q9 o0 Q& dns_marquee.left-=copyspeed {1 I. k# {1 a" Z
else, N9 c" ]* {) j O6 j0 b
ns_marquee.left=marqueewidth+8/ Q+ l# p% z, P& K$ k
}
5 ]4 a5 W' {) n3 `0 Q}
- w0 g }% C. D& g0 {
0 P, D; ^# P5 Z+ z+ E* ?if (iedom||document.layers){, C& A# _( r* G. T1 O
with (document){& V5 b2 J) |, H7 @: J k
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! ~. M( X2 T( y% R0 i2 y( Eif (iedom){" V$ `" n/ z' ]7 _& m* L# W5 |. B
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 @% J; p9 s% lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 ^2 }- @9 j4 d- B
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% [. B0 p! c" N' X% R% |
write('</div>')& {* o2 K A, @' z. p; E
}
& C8 {* I l5 Zelse if (document.layers){
. d; L& A/ T! h# B- W" v7 A+ F! |' [write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 \ u8 @0 `. P9 c6 Nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# R; W8 Y" b% U; W' F2 f
write('</ilayer>')3 J) D' J4 e0 d' r* ?5 f% A+ j
}$ o2 @* e4 t! E! M6 a
document.write('</td></table>')7 F k' u4 u- P5 j; {; ~
}5 a9 D- w$ l. G9 k* Q2 E
}
# r5 E& k0 h* K6 S+ ]4 U</script> |
|