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

|
网页之跑马灯文字特效
//修改宽度# e( x4 v" L; t3 ?
var marqueewidth=300
# O6 H) `! V# ~$ B//高度( C1 K5 q" j5 \9 A5 @1 c l r
var marqueeheight=25
$ ~: g2 D4 f/ v& V5 `//速度(1-10)
0 Y% z" e% r* jvar marqueespeed=38 U& ?; y, L5 @/ P0 ] p A9 p/ I
//背景颜色
! g) T1 l r% W+ X; V$ S1 gvar marqueebgcolor="#FFFFFF"
]) }* ^- |3 }. s% Y$ Y//是否能暂停 (0=no. 1=yes)?6 |; \0 k* V7 Z
var pauseit=1
9 c9 D. {' k6 ~4 w4 n
" H% J$ [$ X2 S//修改显示内容
4 |. L( \$ G! A8 j; n! ? _var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; @# l( v% Z0 C4 E
' Q+ j% s# Y/ U3 H( |- K8 R
l0 t! z9 h* E' G2 S# S& ?////下面不需改变////////////
, ]) j- c2 ~+ ]1 _) q# Q1 r$ Q
- t+ F5 b! @% V0 Z, E7 L3 jvar copyspeed=marqueespeed
4 v5 p* f$ A5 C7 uvar pausespeed=(pauseit==0)? copyspeed: 0) s$ i4 j5 E K
var iedom=document.all||document.getElementById
3 [- i. Q, Q" m3 Iif (iedom)! X" Y( j! T$ @/ p
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): v( J; Y, U; }$ E$ f" Q) `0 w5 j s
var actualwidth=''% W% Y: [+ d8 m$ I l1 T: i( M
var cross_marquee, ns_marquee
0 d: C! I& ^9 H. O: `& U9 H' W, M
function populate(){
$ |" a3 l; w0 e- g' F5 L! Y% eif (iedom){$ b( W2 g5 w' a5 Z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
% Q+ [ M7 u' N" kcross_marquee.style.left=marqueewidth+8& Q* o, _7 V( x! O- `7 a
cross_marquee.innerHTML=marqueecontent' B; B% l g ]9 p+ p7 G/ y( a
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
' X3 x6 Y2 K. C& L}
. j4 \2 l5 x+ |2 [6 E" z5 velse if (document.layers){% p5 F, x/ f7 j8 y) A( X5 g3 ?
ns_marquee=document.ns_marquee.document.ns_marquee2
0 c5 _ l i* ^: `) [ns_marquee.left=marqueewidth+8! L; v1 e5 D' ]' h# L) z' S( \
ns_marquee.document.write(marqueecontent)
4 H8 G$ m5 @6 Q. z6 Z8 Cns_marquee.document.close()
; m0 S0 ]/ k% O+ \2 }# ractualwidth=ns_marquee.document.width# v4 {. j0 e) @
}
' j0 @. }& X9 \4 Xlefttime=setInterval("scrollmarquee()",20)' h O5 {8 h1 j7 v z
}
& ?- h4 @6 O9 hwindow.onload=populate
3 X2 J& H z( b- b( h$ [4 C& _1 M/ ~! r9 b0 ]
function scrollmarquee(){* @ M1 I% x7 v
if (iedom){0 f& T5 L3 Q+ J0 `+ V
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' H9 m! H y J) N
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) I( r& | A# `% t8 I: S
else
Y$ o% n8 g& b3 w8 P4 ycross_marquee.style.left=marqueewidth+8
) S+ w) A& J% c8 t5 g8 r7 z( X3 {# |( {+ Q: J/ H6 E
}
. r3 m. {* [, E& P- f3 ~) B/ L6 k' Qelse if (document.layers){
f4 v, V- ]9 q- x9 k) i" m! eif (ns_marquee.left>(actualwidth*(-1)+8))
) Y T" ~! _( h# {- F) ?# M0 _ns_marquee.left-=copyspeed
: u; z3 |+ N w5 x& M9 }else+ S) r3 W7 @. a& P/ c2 ^9 m
ns_marquee.left=marqueewidth+8
0 Q$ j! H- } c/ d$ G* x}
1 B* K3 e5 s; t. {2 J2 X}4 O+ f; _' ^9 k3 r
: V$ y" Y8 i' R
if (iedom||document.layers){
9 F$ L9 b; ^1 ?' w" t, _with (document){
$ Z& K( X5 s7 Gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'), O6 r+ c [9 B5 v9 j6 }( N3 K
if (iedom){
, L! f7 ] S E7 r4 z1 [, ~write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. y+ y- i4 K$ a3 mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* K# A: i, E L; dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! n, A3 v& A% M5 w wwrite('</div>')
5 S2 ~# Q% N$ ^+ Y3 j- K* B. t}
- ^4 a6 }- I; c# k ielse if (document.layers){/ E& c; n; @8 ~% o4 ~8 g
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 A" M+ E9 d: C- L z0 M
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), E$ I, O V# y) @. G) i8 U
write('</ilayer>')
: c$ O! g* g; f9 V' x* h# {' G}9 X U/ s. t3 v
document.write('</td></table>')
! y v, _% \! Q7 V}: `; o- J7 Q; r3 p6 c) d i" f
}: k' U" `( r) e1 E( M
</script> |
|