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

|
网页之跑马灯文字特效
//修改宽度
5 e0 I, o# a; w- E, u9 yvar marqueewidth=300
3 {7 {1 @# t6 i$ j% n# J5 b//高度
0 e d; v4 T% G8 mvar marqueeheight=25
4 }/ c# }+ k, V( m( F( |//速度(1-10)5 s8 Y! ?$ B& ~/ h( A
var marqueespeed=3
, L* A, r' o% I, H# u K0 F# E//背景颜色% O" l8 I6 m8 @" r8 W/ j C8 `/ M
var marqueebgcolor="#FFFFFF". w7 S% c! G) a# k6 ^* p
//是否能暂停 (0=no. 1=yes)?
! Y: U l. m- d9 {" ~: G1 zvar pauseit=1
" @3 y0 J$ Z! ?% x
: Z$ M9 b+ [+ Y//修改显示内容
7 ^- U9 W1 f3 P# zvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# n5 v+ B( E4 B( E4 u& j
- N$ |2 h1 Y" Q: n( E/ @' G$ o$ d2 x
////下面不需改变////////////4 Q; G- }& C) Q+ f a0 ?2 x
3 _0 |, W/ w( fvar copyspeed=marqueespeed+ X: E3 J4 \! b4 h9 X7 d) f
var pausespeed=(pauseit==0)? copyspeed: 0- {( \! f, H4 g
var iedom=document.all||document.getElementById5 r: K) A; T @' ~7 x6 A
if (iedom)- D7 \. ]- Q5 u
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: W j( b, E6 o/ A: Xvar actualwidth=''
1 ~3 \: ]- J3 g0 O4 u: ~& X+ Gvar cross_marquee, ns_marquee
' D# y' _2 X1 I/ ?& m7 b- h( U f# l+ j
function populate(){+ G1 T" V7 D- B; G; p
if (iedom){
8 i2 T5 A- |0 p7 y& t& vcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# `- Z. I8 i8 J8 Q% k2 F5 s3 a
cross_marquee.style.left=marqueewidth+8
: q& ^# v" M9 d6 M" l8 h; Q# C5 _8 N. Bcross_marquee.innerHTML=marqueecontent
1 \5 w. b3 C6 a; Z( U* Yactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
n# }* o h# u9 ?5 E X}
) n" L0 @* _3 {0 ^else if (document.layers){
3 n" W' P/ k* q0 M7 @ns_marquee=document.ns_marquee.document.ns_marquee2, \- _$ q( I" H) P* X! y
ns_marquee.left=marqueewidth+86 P: W% Y0 {( E- u" r
ns_marquee.document.write(marqueecontent), C: ]! V" H3 f+ }1 t1 {8 D
ns_marquee.document.close()
3 v% ]% z2 e: v/ u" S9 Q7 N$ Jactualwidth=ns_marquee.document.width
. H! ^; z4 q+ D, F% d- n) t% S2 ]}
' S$ u8 ~2 f6 W$ ^$ l+ }) olefttime=setInterval("scrollmarquee()",20)
) C5 E$ B- a. ]) t/ j, b% u}1 h4 x2 n' V* E- b
window.onload=populate
( V3 @$ d. w$ t, ^
4 k: j/ Q7 Y) |' P; Vfunction scrollmarquee(){! D/ l! v: _' R* ]+ F
if (iedom){
9 k; l. b! w( g9 vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 }5 b$ v2 Q3 G1 \4 b
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed, l7 I; M( q" z7 z: p
else
3 I. L4 P; f/ m4 s- C( @+ Xcross_marquee.style.left=marqueewidth+8
; ~3 i! W% }+ |" {
4 m+ v! H8 o; P2 @ E \' Q}
/ K3 y' [! w& ]" |else if (document.layers){) N) F; e" m" z
if (ns_marquee.left>(actualwidth*(-1)+8))$ K( V) b7 I9 v z7 b, @$ U
ns_marquee.left-=copyspeed
) ]/ t) p f0 J/ \# u- m6 Oelse
6 Q4 [! U% n& H U; Z: Dns_marquee.left=marqueewidth+8
. c& L3 W9 s/ @9 }4 f" F. j P} T- r. h5 R0 e
}
8 r$ o+ ]/ i& ^" w' l3 d+ Y8 e, s5 ^7 `) u
if (iedom||document.layers){
8 F6 G c5 @" S' Nwith (document){
) I" ~ M% @; xdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 j" p/ K' ~/ Q) f2 Lif (iedom){
1 d) G* D6 @7 W6 a, J: Qwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 O* J$ b; z& y ]4 Cwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# f4 o- ` l2 Q7 R- Jwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ V# A9 ^+ X" q9 Awrite('</div>')
* ]% Y5 E8 D. j* U$ {7 ?}& N! A$ x8 {. F+ C" i- N+ q1 s
else if (document.layers){/ h9 u# R/ M3 J; t" G, g/ y5 ~2 w
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>') z: ?' s8 z' b2 {2 O$ s2 B" S+ Q
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 h9 M; Z9 b& a
write('</ilayer>'). W( M6 b5 h2 o, ]" W, K
} L% t2 Y: X" }# R+ P
document.write('</td></table>')0 _/ x8 R' {( J8 V' v
}' m3 H! A' k# l, l, l$ V
}
* O; U3 n: y1 K: t. B3 O</script> |
|