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

|
网页之跑马灯文字特效
//修改宽度( Q7 c. g" c0 k% d
var marqueewidth=300* n( o, N* m1 U Q* }
//高度; \6 }2 t9 t( w# G* d9 U5 Z! H
var marqueeheight=25
, W( C( a' g6 P; M: t( r//速度(1-10)* _1 T1 O, c) I I2 `! v
var marqueespeed=3
% j6 o. B' X% C6 }2 M0 `//背景颜色
, K- j4 r) K% K- Ivar marqueebgcolor="#FFFFFF"
% D9 R. \0 v) z6 _//是否能暂停 (0=no. 1=yes)?" ^4 H# q4 U2 V; r3 {3 f& `1 T. A
var pauseit=1
4 Z$ D6 s9 y/ |3 x. V4 }% _: Y2 I1 v" U4 o% t
//修改显示内容
, g7 }, ~6 a! K: pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( |3 }$ \' H* A9 r: Q
! {2 ^: w: R: V% ?+ L! ~
! f, s" w+ l3 J
////下面不需改变////////////' ?1 U( V, c. G, u( g) n+ k0 L
2 P0 o) Z3 h( @$ h5 zvar copyspeed=marqueespeed
4 Q( k! o- L( ]/ t) [) z& Mvar pausespeed=(pauseit==0)? copyspeed: 0
; \+ u1 S/ k" P# {5 q2 y" Fvar iedom=document.all||document.getElementById
! y% Q7 R5 e5 q( R" _5 [# e$ Pif (iedom)4 A9 n' Q. G! R7 R, N6 v: K
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" U; R5 d! H: b, ?' N( Bvar actualwidth=''
' r7 y3 h5 K A! V7 V0 \$ j6 z# Z2 T5 vvar cross_marquee, ns_marquee
! y' }2 k9 f% N: l4 G5 g4 b# L1 r; i8 D" m
function populate(){- t* C6 i! Z) \* u
if (iedom){
! Q. ^8 m+ `2 l1 I9 _9 ]cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
. O2 h$ Z/ Z5 P. V- @- Q# Vcross_marquee.style.left=marqueewidth+88 v* r% x8 A/ b, Z6 k r5 Q' m% h8 B
cross_marquee.innerHTML=marqueecontent( i5 h+ m& I% E
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% ^. p2 W+ Q( s+ h0 X7 O}# b, }: B; Z. e4 [9 z
else if (document.layers){
3 p8 P2 }4 Z4 |& ?ns_marquee=document.ns_marquee.document.ns_marquee2) b- V9 g) ~8 \3 u& ?. f
ns_marquee.left=marqueewidth+8
% w) j$ O) u$ X# @1 l% Q' Lns_marquee.document.write(marqueecontent)
# f, W0 V a! ]1 dns_marquee.document.close()0 m& n6 H% ] L
actualwidth=ns_marquee.document.width
5 w) V: @! Z, @8 d" T}# i; a; ]4 ?) C% }
lefttime=setInterval("scrollmarquee()",20)4 w% p: T# m w+ D! |" H
}% P( J- h. Y0 X) g7 l. ^; `; a: i, y
window.onload=populate
+ W2 M8 e& ~, h% ^
6 C: z" Q$ ~1 ~* h! |: Y1 Vfunction scrollmarquee(){
$ y2 B5 c. H2 xif (iedom){& V! G3 l& z( k4 `" b7 ]5 Q5 d. O
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ I7 `! u0 X+ P
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) n! V. r. N, B1 o! R1 c Z
else
5 b; T3 f) n5 s. |) _cross_marquee.style.left=marqueewidth+8
3 f' r& e3 q6 ^# O2 B+ q* K% W) m. K5 h. w8 S& A8 c1 o' }& y( k
}
% x( ^) o3 R! F W+ ]/ \else if (document.layers){
6 q; B+ _. D7 Z1 m! zif (ns_marquee.left>(actualwidth*(-1)+8))
9 a2 C6 D8 y6 r/ ens_marquee.left-=copyspeed
/ M' E; r7 E' F8 O( Z# belse
& |* U* Y) |. M% s; p7 @ns_marquee.left=marqueewidth+8
4 `- m0 Y/ p4 L' _}
1 `2 Z7 i- Y O}6 B7 h& I( u' b+ A( n0 b
8 v y3 l( g# `2 m; y/ L, m: p, S! v4 ~
if (iedom||document.layers){9 f ~6 Q9 u5 M
with (document){( L7 _' P8 e" Y. \
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 y/ ]1 E1 t; ] a- dif (iedom){
; B, p2 l: T" x! zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 J( `- d- ^' D0 Fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( t: K" q9 P8 D$ y: u8 u# Zwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')5 y" X- ?% H. { c: v( i
write('</div>')" w } ~# O/ ~
}
/ @- ?0 s/ g* a- Aelse if (document.layers){
}: a* o1 D* J& }write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: j2 x: {5 v7 R3 z3 E& p, owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ K: a& u4 @2 Q Qwrite('</ilayer>')5 O) d+ a9 o( E% o( n
}
3 ?* k0 v" Z5 M( A2 V' adocument.write('</td></table>'): u0 y! I$ [& d# x
}
8 f1 W( l7 p, k) q' G0 i}* L. ?4 s8 F7 [- H' ~& n2 w
</script> |
|