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

|
网页之跑马灯文字特效
//修改宽度. _$ [) D* H3 `2 [0 q% E g# C; C+ u
var marqueewidth=300
/ B9 c: w% c5 F ?) E//高度
5 T) C' U: R& `- n* X! j- X& fvar marqueeheight=25) K, a4 J$ K1 }# C3 V$ x* B S, n
//速度(1-10)
* p8 [! q6 A4 _9 ivar marqueespeed=3
0 C2 N; E- Y- h. ^8 X$ ]6 L//背景颜色
+ M# U U9 b8 P/ ]7 M+ Ovar marqueebgcolor="#FFFFFF"
" [" E6 U$ p0 B+ W$ t* Y" J//是否能暂停 (0=no. 1=yes)?% t+ m, k7 V. a) _; d
var pauseit=1
! g9 d- w4 J+ ]/ z, m, l( b @% D% a3 W; \# }: ~" N; [8 L
//修改显示内容
7 I* O$ B8 z9 u0 v9 yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'$ W. X$ f# K7 T; B
9 a3 k* p+ i% b0 Y/ L7 {& ^
+ r; J5 B9 I$ n+ D4 ^5 H( @) `' P1 U////下面不需改变////////////
9 A& \. _/ \& O4 [) N
! P) Y0 ~* d# T: r/ \3 ^var copyspeed=marqueespeed
- }1 C- {$ @5 X, t' ~var pausespeed=(pauseit==0)? copyspeed: 0+ f: z- S1 q1 D) j. [* H
var iedom=document.all||document.getElementById u3 J/ v6 y8 ^; Z" W5 q- w
if (iedom)' }; J0 G8 m- ^$ w- A
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
4 c3 w# N$ i' L3 d/ w7 A/ O/ V6 ^var actualwidth=''9 W. F0 |! _- e( a" u- u( }
var cross_marquee, ns_marquee
U* p6 k! @5 z8 x0 ~
7 n9 H/ s' D! r3 \6 B& Ufunction populate(){
0 Z! \$ G# B0 B2 Gif (iedom){
: o- Q4 ]8 P @+ M7 ?# @cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# h& `* Y5 A& r m8 W+ k% n9 Zcross_marquee.style.left=marqueewidth+8
, u9 ~4 H Z1 {/ l) G( Icross_marquee.innerHTML=marqueecontent
4 @% p- B* \3 v/ hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. D) j* B( @( s. v+ c( R' x
}
! ^9 X2 v' c r+ R. Lelse if (document.layers){
! m' m3 n; g$ j7 Ens_marquee=document.ns_marquee.document.ns_marquee2
& O# O- r4 W6 t: I* V$ fns_marquee.left=marqueewidth+8* d1 W' m% J3 H" s u
ns_marquee.document.write(marqueecontent)% ?- Y. X! X* ?* i
ns_marquee.document.close()3 t2 e. d( C! Z# @! v3 n
actualwidth=ns_marquee.document.width
6 M$ M" S- B3 M3 I6 q1 f9 [}
( D" [' d0 t# I1 ^ U( |lefttime=setInterval("scrollmarquee()",20)9 K! _3 b' ^, O0 W
}9 w' R$ I P. U1 Z/ v$ ]
window.onload=populate
9 N7 y8 |3 l' _- e4 N4 b% v h
# S( o% r6 r# o" f Y- I9 ] {function scrollmarquee(){
# \+ N# l# q+ q9 ^" Uif (iedom){5 W8 e- I' y* V# \2 V' }6 w
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 G& u1 r$ t+ W' |cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: g/ C6 k& {. g; w" y# Velse" D2 n+ r/ A/ W
cross_marquee.style.left=marqueewidth+8
# G0 @/ g; Y4 a: G8 J( G7 }6 J" |0 l- ~) S: ~/ P. v7 C
}
/ l' P" E$ u; d/ d( oelse if (document.layers){
6 V3 i, x* y9 Q7 G3 f% \0 k% Bif (ns_marquee.left>(actualwidth*(-1)+8)). ~4 }' X7 R7 O, u7 Q& E. m, N" d
ns_marquee.left-=copyspeed
# I8 l1 y$ [5 M. C( D, | felse
1 T" W4 h, l7 L4 @: uns_marquee.left=marqueewidth+82 I8 c/ E3 K" Q
}6 ^* I3 W9 A' [( w( |; q
}
" P) t8 Z! w# K* Z; ^) C, @0 P6 W+ `4 a! F& x1 X
if (iedom||document.layers){
8 _1 n7 A; j& r5 O& Wwith (document){
0 C4 G) Q3 {! @document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 E8 e& r/ ~ S0 c, R; d: jif (iedom){ l0 y, U- T" S/ r, C! N: ^
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 M8 @* U( r, e; |+ a/ z5 ]5 k
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
3 ]! k4 G4 {, [9 E: Hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. ]5 @* G, a" K7 b0 H: d2 c4 ^write('</div>')
0 N/ m0 Q* M+ L: }% P. d}
3 b. X& H5 H* i! s- ielse if (document.layers){" P A: z- l: X
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 e, D! L6 c" n( ~7 M& T) w
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ ?) o- _5 j$ C) y5 ^( C
write('</ilayer>')2 o9 e& c4 m f3 N2 t( P8 x
}
2 {1 E2 @+ C2 _) o% `document.write('</td></table>')/ K$ Z' T! a; u8 H
}: Q" z; O" N! C( o/ w: \
}0 P* r! o. b X
</script> |
|