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

|
网页之跑马灯文字特效
//修改宽度( k9 c3 y [) A I; r4 u
var marqueewidth=300
/ ?( ]+ e+ d7 G- B5 u//高度
/ d3 O; r. ]7 o, D3 O' Fvar marqueeheight=254 V9 Q" x5 q! M
//速度(1-10)0 D* x! t# [) @8 X. Q5 B4 l
var marqueespeed=3
- B( t- Y6 f u# [//背景颜色
- r; B# d+ A' ~4 B/ a: avar marqueebgcolor="#FFFFFF"
$ A8 G" k, z$ ?( m% [+ U//是否能暂停 (0=no. 1=yes)?
: i7 w2 E" }) ^3 Zvar pauseit=1
4 |4 ]. x- d$ @( P$ K
1 w) k- I% k% b* i, f/ y2 T//修改显示内容. [; j+ O7 `, J( z3 `
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# M1 E% v3 R' h$ R4 F, ~2 P" |
; M$ P% Y$ ~9 R: P! U8 }" x" K: h( }' _ \" r
////下面不需改变////////////
/ u- ^' s+ u# J+ k( [- q' \! F" K, i. B& Y/ u) |6 B) F
var copyspeed=marqueespeed1 }* L( N. L$ |5 [
var pausespeed=(pauseit==0)? copyspeed: 0# j' x/ U/ F0 m* n; S% y+ e7 t
var iedom=document.all||document.getElementById ]" U2 o0 i! u7 Y
if (iedom); B4 f+ P" d7 a! L# j* H
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# v: s b/ C* r5 H: bvar actualwidth=''
8 e2 q8 [: b; \9 m$ Ivar cross_marquee, ns_marquee
- r3 Q' I8 k) c8 e4 k; v& ]: q9 p8 c. ], ~! v
function populate(){! J: a6 s; Y% w3 ?0 a0 Q
if (iedom){7 X/ f7 n. H; v: y9 E
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 z' b( `) W( A8 Gcross_marquee.style.left=marqueewidth+8+ R8 q( q& z8 f
cross_marquee.innerHTML=marqueecontent6 f/ Q Y" X0 h! k/ h. Z9 p3 F
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- Y- n9 j' r- f9 _
}( {' y7 @% B" e& q# H6 I \) z
else if (document.layers){: T! p( i% e/ o% R. T% @% ^ Y z
ns_marquee=document.ns_marquee.document.ns_marquee22 k* w. d* e% Q1 B
ns_marquee.left=marqueewidth+8) |( U* C+ s9 ?8 Y9 e' ^3 ]. _
ns_marquee.document.write(marqueecontent)
6 w' ?* h3 r5 L4 V; Yns_marquee.document.close() b9 @+ [- r$ L: C0 @, o1 ]
actualwidth=ns_marquee.document.width
9 m' S; O8 [) s' y. H) y/ M}
9 y* K% n. d# Q% L; y$ ~. B$ u9 c! clefttime=setInterval("scrollmarquee()",20)
( E/ C- J% ]% e1 S7 L2 R7 V% _}
2 D0 Y: N$ C! }' p/ Qwindow.onload=populate# ]' X, @+ c X! s i9 L' ?7 \
) e$ @# A8 _3 `$ G {8 |function scrollmarquee(){, s* ^ V7 S* Y* e4 {3 ^
if (iedom){
8 J q c, k& {( gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 K4 s" l" ]6 ?; F- L- \/ ?cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ L: J, @! O/ p1 l9 B8 l2 Welse8 |8 P" c4 Z0 L2 n' k: K1 Y
cross_marquee.style.left=marqueewidth+8
' p! N+ M/ E6 l D
! X1 y" g& O+ Q8 \9 _# Q I}
d2 K6 ], t( ^4 r; @+ melse if (document.layers){
: O$ S/ J9 w+ u6 a- j0 oif (ns_marquee.left>(actualwidth*(-1)+8))
8 y/ _. t. j! k3 w. y- v; j" vns_marquee.left-=copyspeed; c. F4 h+ c3 @4 ]$ O$ Z8 @1 k
else
9 S9 D4 q2 n5 {$ u1 L; }ns_marquee.left=marqueewidth+8
- c8 I1 h# C; ^8 s8 T- A}
! g Z1 C( Q. x3 ]% b}
5 X5 C9 J6 U4 e: b* x, Y Y1 R6 t
if (iedom||document.layers){ Q$ m$ i6 r* E3 }7 r! v" j
with (document){
. T" ~) x4 Y# p$ [) O6 Tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')' f) k( t; @/ d7 X* v
if (iedom){! e3 |+ O- Z# d: J
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) K( a( X0 b" d; p3 ~$ p2 Ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
' [+ U8 U# `, V; f+ I: dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); ]# z6 q# }. _! W+ _
write('</div>')
7 z( D8 O4 j8 g- t3 l7 S# x}
9 T g" k- H, @5 S4 b( D* qelse if (document.layers){
, K4 G6 i( E0 P# I8 F5 ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 Z8 ^0 O) t+ B
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ E' A% P( I4 _! R! p
write('</ilayer>')
0 V9 z, `9 h! I/ {% ]0 z' t1 n}5 r! W1 g( }' u
document.write('</td></table>')
* R; v$ ^2 f4 t}4 s5 _( d3 A O: T2 y% N K
}
' O V7 K H- G q4 Y</script> |
|