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

|
网页之跑马灯文字特效
//修改宽度
: ]% x _7 ~0 B5 S% ^+ i4 Jvar marqueewidth=300
, V( b3 q1 J, I//高度1 y: D; b( N! h# {& H: E1 h
var marqueeheight=25
2 {/ e# d1 O: J( ?' F" J2 T//速度(1-10)6 c9 `# i g8 |
var marqueespeed=3
/ C8 h6 X. \( u//背景颜色; q9 B5 P, C3 u
var marqueebgcolor="#FFFFFF"
: F) S& `3 q) g//是否能暂停 (0=no. 1=yes)?
" [0 P0 Q0 t2 S8 k" [var pauseit=1
, j* b; V" V% ?5 A# E0 a8 o+ n% ?& J/ ^
//修改显示内容
2 q4 N _0 [% e$ q5 T$ nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
- M# M! L; z. f2 T5 s7 s0 C& Q( X: s& N$ V3 N. y+ A& F
7 ]" ?. G2 j1 n9 k- g
////下面不需改变////////////
$ \, m5 |8 J' x2 P3 D8 p9 Q. X$ E2 n0 Y! l4 q8 j1 [$ a
var copyspeed=marqueespeed" C/ N( v- F$ Q1 ?
var pausespeed=(pauseit==0)? copyspeed: 0
( z( K2 }# H, |- k3 avar iedom=document.all||document.getElementById
- z: K% _2 L! J( T3 P V, Gif (iedom)
) b$ z$ R: |' D0 ]/ B8 x8 Xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 R2 x. \! x# C" i3 X5 I2 C+ Evar actualwidth=''
& Z6 o. M6 k# ]* k4 E( i3 L- s+ J% I) L3 evar cross_marquee, ns_marquee" M5 i `8 ~& C; \# P
) W& G1 y( n3 m
function populate(){
9 s' p1 B. q; x) }, fif (iedom){ v5 E- g/ F1 T# N
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 g% D% K; l+ ]! w* q2 I+ ~7 }
cross_marquee.style.left=marqueewidth+81 K# I+ H* _5 ~
cross_marquee.innerHTML=marqueecontent
& y2 a7 L9 `9 m1 [% O6 U. ?* ~4 L- Uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* m1 b0 p+ S) F/ I+ d
}
. [4 K$ X/ X' f& A7 lelse if (document.layers){3 ]/ d7 t) A4 t: t
ns_marquee=document.ns_marquee.document.ns_marquee2
7 _+ y% \# W, f* A9 C) z* ~ns_marquee.left=marqueewidth+8, z- t0 W/ K8 q* z/ D3 q4 m
ns_marquee.document.write(marqueecontent)
9 ?; t* e( a; W$ f- n4 ons_marquee.document.close()
4 \& n% U6 t) N. v# X5 F6 `8 |: Oactualwidth=ns_marquee.document.width1 k8 [+ h* A+ K8 a- I/ E
}
( ~0 y L8 e! vlefttime=setInterval("scrollmarquee()",20)3 I* F0 ~3 h! n8 ^
}
# X/ x3 N3 w( V( O. [( S6 F! zwindow.onload=populate* }# N2 |& w8 ?1 @ z
# }, k; s9 p1 @# f0 Sfunction scrollmarquee(){9 r4 _4 ^2 l9 ]- w$ W" O3 ~( T
if (iedom){
) w: R9 {8 R, J& t& [if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 l! L% X3 u6 Vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% @8 c0 {9 [& z7 Q4 m& k
else
! K9 w% e G) M, a Gcross_marquee.style.left=marqueewidth+8
# s. f2 s" ?+ H
% s q+ d7 x4 x* v% b}0 H' A B( V5 J
else if (document.layers){( K5 P- t2 r, ]$ D) g4 J
if (ns_marquee.left>(actualwidth*(-1)+8))/ x" B9 [& B' m- ^
ns_marquee.left-=copyspeed8 U/ E) E5 p0 H0 q8 \
else
% k9 L' S0 A: z( s' u+ g+ d& tns_marquee.left=marqueewidth+84 F5 P: M' d; @
}6 b- M+ w6 T$ n0 C' w2 G
}0 s- G! J0 x! Q e" Q, ^$ F r+ Y
1 X2 O0 Q; w) \! A8 O3 l; K3 |' Jif (iedom||document.layers){. [/ T5 Y. I; ` p" U: o, l6 m5 g
with (document){
1 j7 M# K& K2 xdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 @! l) C2 o/ Y6 p, x2 N
if (iedom){4 k1 i& n/ K# d7 {
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& y- e' C# J/ F( fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); {# R I9 j! B. H% m$ K: v% K" p' V) O
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 G* c5 T6 t+ C( lwrite('</div>')
; A2 r1 }8 l9 V( m( I}
h/ `5 T% b/ M* p0 Pelse if (document.layers){
/ L* B9 v/ i- s5 h P4 Dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 u5 h0 O' @' H% a6 L; o5 `write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
$ `- `* t; z$ nwrite('</ilayer>')( Z4 j9 E, ?! E
}
( _& ^* Z* |2 m6 N) d0 g _% a$ Gdocument.write('</td></table>')
6 Y8 h7 d' K8 H}- \6 g( N, A2 s1 \: a5 [9 L2 w
}, G ^9 N7 H* f# l% o8 r
</script> |
|