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

|
网页之跑马灯文字特效
//修改宽度
. J5 N4 M2 U6 C v6 e& @" Y5 |var marqueewidth=300
" L5 `# V) M5 |7 {8 `//高度; ^. E6 X3 T% @# i. }9 l. P
var marqueeheight=25
4 H4 p' D" N0 ]/ c' Y( l//速度(1-10)* G+ U5 Z5 M" J3 j$ h% X7 j! I: M: h
var marqueespeed=30 i1 x1 q! ?& l2 j9 r
//背景颜色
( ^& W* r8 m* T9 ?5 Rvar marqueebgcolor="#FFFFFF"1 S, Z* ^/ t2 k6 l4 n
//是否能暂停 (0=no. 1=yes)?
- S+ f3 b6 {; @" V7 Dvar pauseit=1! Q0 b3 C" K( n" G) F3 w- s
/ W; X" }3 a$ \3 u//修改显示内容
3 a# Q9 j9 m' _; S# @, Bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ o" B3 g Z+ Y7 s# q( `* i6 d% R4 r: X4 ]& u' n
& {- k& o$ v4 h; L: d////下面不需改变////////////3 c3 J8 R- E+ k2 H, G4 t
1 k! q! Z/ I( O
var copyspeed=marqueespeed
+ n! z9 [9 B7 O( R* \8 Xvar pausespeed=(pauseit==0)? copyspeed: 0
: g$ v) q4 |& f+ wvar iedom=document.all||document.getElementById, ^ z; R6 S/ V: E* N5 Q8 D
if (iedom), d% p' G( m' b4 z! q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 L: h4 K/ e. V) t& c
var actualwidth=''4 D9 m. E3 t$ e T4 q1 e
var cross_marquee, ns_marquee
5 v' ^1 S5 O- g. p0 Q
! o. ^5 d- @2 D; q# n/ E$ v5 u6 sfunction populate(){% b b5 a5 m& {+ `. Y! M; j$ t
if (iedom){3 o' T5 ~# ]! O* u
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- n) N( [9 V- a* i8 L) @
cross_marquee.style.left=marqueewidth+8; s3 K' c/ y2 W9 e# m
cross_marquee.innerHTML=marqueecontent# a9 r3 m% i5 S3 Y5 L
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ K% S* L( X5 d0 z$ k$ h$ v}
* `- B( w1 D- T% ~" U- Gelse if (document.layers){
/ G6 F. l) r0 H6 V7 O, y1 vns_marquee=document.ns_marquee.document.ns_marquee2' y$ m7 `. h! e! d
ns_marquee.left=marqueewidth+88 C- J# ^. i8 i; j
ns_marquee.document.write(marqueecontent)( d/ \+ Q" [% F
ns_marquee.document.close()7 {4 ~, y/ x. f6 J: [4 ]' Q2 b
actualwidth=ns_marquee.document.width/ q \* X* w, x- ~6 }
}$ r+ q0 J, w( M3 E& H/ C
lefttime=setInterval("scrollmarquee()",20)0 E& N' _5 m, d5 Q. D5 p' o7 o' Q( C+ _
}* v1 k2 H1 v+ Q d' J
window.onload=populate0 n. o9 B3 h. h, O, U# f
! `8 w0 [( _; {7 sfunction scrollmarquee(){3 n/ W+ {- M$ l# h
if (iedom){( K0 ]- y- x" t; s
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' {. l; b+ D J+ Q6 N1 J1 ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 S- m0 ^# [( _) qelse! q. E4 w3 y, W0 }/ N% z. \
cross_marquee.style.left=marqueewidth+8
0 w3 X p |- N( `0 A) ~- v' l0 h9 w5 j# }
}& q" W$ q- @* f% ] W
else if (document.layers){
, Z6 a0 k# q- ?# @( Sif (ns_marquee.left>(actualwidth*(-1)+8))
" |: F7 |, h l" o R, K9 _8 nns_marquee.left-=copyspeed( o) G' G. n: o
else4 J% t" z8 C5 N/ n
ns_marquee.left=marqueewidth+8
8 u4 F, o7 J1 u8 y}
% i, `. j |0 l% n5 a% ]0 ]3 H9 v}
- w- s; F s+ L
& F# {6 L V( dif (iedom||document.layers){2 ], O$ v; [4 v9 Q' l
with (document){8 {6 c4 y8 h9 u2 A5 j
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! E5 A" N4 f. ~& I; iif (iedom){% x+ O/ k0 {* X* |9 }
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 x5 \5 n3 k( |8 j5 bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% f6 e* j2 d! P& \- W3 C0 U+ ~! O" v
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 e& G" C( f# V
write('</div>')5 C; D3 B2 m3 N8 X# Z" t
}# x% d' T) M" n0 M M: x
else if (document.layers){4 g" E' M6 N b" |
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ @* J- p v0 o8 R7 h, L5 vwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 K8 g \1 C3 t0 Pwrite('</ilayer>')
/ U3 p6 q# k u% Q% H5 M6 d}3 x% j- ?0 P4 n3 \( m
document.write('</td></table>')6 O+ ?) d+ U/ n9 Q# X1 O
}! `5 }1 h9 d1 j9 K
}% C+ h) [$ _: A9 X4 o! B/ F
</script> |
|