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

|
网页之跑马灯文字特效
//修改宽度
) L0 V( c. {/ n dvar marqueewidth=300
$ {$ H5 N2 }6 k& x' |; W$ _//高度2 q$ \0 ~: w" D2 A( s! z7 s
var marqueeheight=25& r& a q8 H) [7 s X2 r/ B7 p
//速度(1-10)
! M$ i( U1 B4 |# R w& j5 x$ o* gvar marqueespeed=3
8 K$ l% v/ g" C7 J//背景颜色
- K3 w0 U- [) O/ ~* [' yvar marqueebgcolor="#FFFFFF"
0 i' S4 ?- ]( m0 Y//是否能暂停 (0=no. 1=yes)?4 U: g8 C( F+ T9 k9 N$ O0 v" O( Y$ U
var pauseit=1
# `' y6 J% ^# f5 w3 p( J" ]2 M% W# z% t4 s
//修改显示内容
3 C9 u' e* i) K; m1 avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% m2 I; k4 c- p2 u
$ e8 D& i6 m; W( E( C, _
; h! `- p! n6 [$ @$ \- U! D////下面不需改变////////////
/ d2 V* b, V4 B+ d: e8 F2 R/ m
3 X6 p9 U# U7 F8 E- P* P" R% vvar copyspeed=marqueespeed
6 k8 I1 y6 y. ~2 T4 r- Kvar pausespeed=(pauseit==0)? copyspeed: 0
; ~" ~. K: k. X3 k( x7 ~; W, nvar iedom=document.all||document.getElementById) E( L" r E! N* X2 X5 t/ p+ p7 }
if (iedom)
$ \! q8 X) P" R* R/ _* hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 Z5 z5 k2 x8 p9 N% k& o* Cvar actualwidth=''; ~( W+ D* t+ c& d
var cross_marquee, ns_marquee
+ t7 {& u" m- A) w2 z
& c9 O4 T9 j. h. s0 O7 z' sfunction populate(){
/ e3 q% k& I' o* e7 kif (iedom){, w& n' B/ f0 D3 r: R; r
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* i9 \4 R. p5 @0 F; }" ^
cross_marquee.style.left=marqueewidth+8. Z; b- ~, j7 N7 L* z' ^" J
cross_marquee.innerHTML=marqueecontent
( v2 k/ _ e) N/ L/ Z( m. S3 nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth& a. ^( i5 E6 ?
}* r w, p, n3 }7 x. U4 S0 j6 Q! N- _
else if (document.layers){) _) _7 `/ |3 c7 a% P
ns_marquee=document.ns_marquee.document.ns_marquee2
. V/ f8 i7 c( v/ G; P0 jns_marquee.left=marqueewidth+8 x( e6 |/ }* ~. q6 I0 Y7 {2 G
ns_marquee.document.write(marqueecontent)1 u# `. X2 t: i# S g2 N
ns_marquee.document.close()
' U8 t s' C( J) W% P1 }; O+ P$ vactualwidth=ns_marquee.document.width4 h( D3 `. b! }4 @# g+ p5 a7 |
}8 A- F4 m" R: V& E3 N/ @3 ^' c
lefttime=setInterval("scrollmarquee()",20)
# e b- s' v% n* N}
, F2 I# G' U# Y7 g; O' P4 Xwindow.onload=populate& \5 A# _+ W! k+ ]* s7 g) E
4 @, Z3 x$ M5 _8 n5 ]( B
function scrollmarquee(){
/ \; l7 P, c4 x0 d) b( P8 i l5 F$ }if (iedom){; {9 g* v/ ]5 `5 h5 r4 ~6 v2 J
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 Y7 g6 L9 c* A6 g. N
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 f- ?, C- C& m% M3 velse2 \% ^5 j8 ~9 m' u. G! |5 `7 h
cross_marquee.style.left=marqueewidth+8
$ L+ C* K" k9 h! n; [
1 h5 p" v. {: H}
0 y6 K2 l' _- ^6 P6 o4 t; i) oelse if (document.layers){- K. d4 G- J! |' d* d5 Y1 \# v
if (ns_marquee.left>(actualwidth*(-1)+8))
. `% I) S \* c( B M# Ins_marquee.left-=copyspeed8 h7 r2 `3 b6 E
else
/ V' ]* b8 x: O0 vns_marquee.left=marqueewidth+8, n2 A( x% Y8 p1 l1 Z8 }
}
f. {7 a9 W }# l4 z- @3 C* Z}
$ M6 r& \6 s! @
+ O, B: M) }9 o0 ?if (iedom||document.layers){
1 i3 A6 W+ v! P' l t- D& Kwith (document){( A% a5 E& t# p6 N) v: k
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')4 Q: z3 ~ e' S( ]6 q- G8 G3 _
if (iedom){
$ k3 f; r' m" D7 w Vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 {+ ?/ r& J/ B9 Awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' e: r9 ?. M% _- l2 J/ S! f
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; Z' M! x2 {' `' E9 M E/ T$ Hwrite('</div>')" g9 a# ~ Q; P2 m* f, ?/ A
}
) c5 L" d4 p0 {2 e$ G: f% _, delse if (document.layers){
3 O6 _* R" c- `5 o: v2 c& a8 cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 f5 i$ Z' m' S9 d7 J0 J
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 N" t" B) J4 U9 O: m- c' \write('</ilayer>')+ t# c( b# E) m
}
' r8 g4 f9 C) q, q, Vdocument.write('</td></table>')
0 j* _" z( _: f; U& |% Y3 v}4 `" W/ s3 V1 [; w6 A& l. ]
}' V3 C6 u3 E3 {: W: l, c
</script> |
|