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

|
网页之跑马灯文字特效
//修改宽度
$ L. S; J( f* p Pvar marqueewidth=300* E7 ^/ J! Y7 i9 a; U- @
//高度
6 Y/ d) S4 S5 Xvar marqueeheight=25; e! M& t: q) w1 U
//速度(1-10): C7 \6 T7 L5 S0 }
var marqueespeed=3
- r9 M' E( m! r//背景颜色& t7 s6 s, ?2 n; ~
var marqueebgcolor="#FFFFFF", F( ]: @7 E; t8 ~- }( A
//是否能暂停 (0=no. 1=yes)?
: D- W" H3 d0 i- [% Yvar pauseit=14 y* o/ B/ s" L6 H
8 ?0 n: y8 V' D2 E
//修改显示内容
+ M- r; d8 E6 V; |: m/ rvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 ^4 u5 l" o* V$ ?8 W
' q0 J3 [ n% B% F, c4 |
5 q" v. t6 _* k# [2 p) s- b////下面不需改变////////////: _( f* f7 M- k
0 B4 v0 A; Z% O+ E
var copyspeed=marqueespeed
0 t( N( n" H9 ~8 @var pausespeed=(pauseit==0)? copyspeed: 00 I6 b) o3 {# p8 K2 {' R
var iedom=document.all||document.getElementById5 i0 N$ g$ b0 D0 Z' N# }! i! T
if (iedom)6 {5 l& [9 S+ z7 k
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* [! u- P0 ]( ^2 i. @4 Kvar actualwidth=''$ F8 O2 L7 O+ S7 ]* ]
var cross_marquee, ns_marquee
. ^% I) ?" J& o$ _ E( o& C- G2 q" T
function populate(){6 |/ I; F& t$ U" P; ~* B4 j9 c7 A
if (iedom){/ V9 G. I9 W0 e9 H
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' m: c4 w/ e5 C# p8 P' ~
cross_marquee.style.left=marqueewidth+8/ Y9 j# n4 ]/ P) g
cross_marquee.innerHTML=marqueecontent1 v$ S- N/ j6 a3 v1 Y7 x5 g2 [
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 O3 N: J1 z6 B2 L2 X/ ^/ I2 o
}& H3 n8 L6 T: M: G$ u
else if (document.layers){
8 Y+ u0 N( g \9 s# `ns_marquee=document.ns_marquee.document.ns_marquee2
0 d1 z) z3 v( Wns_marquee.left=marqueewidth+8# e+ t q9 T8 w$ _* n
ns_marquee.document.write(marqueecontent)
5 [6 Q* H* \ X% h9 cns_marquee.document.close()
) a7 [' L& X' b& N# K# Lactualwidth=ns_marquee.document.width
% b5 |# Q+ h% N P" H}
; t) }( W' E5 Z wlefttime=setInterval("scrollmarquee()",20)6 g1 }5 \$ g, {7 j3 O( W& h
}4 F, U; U" C9 g) v
window.onload=populate. U0 i4 l0 ^+ ?" X! | |
+ X8 q O; Q2 h# Rfunction scrollmarquee(){
" E1 ]. u7 z4 B. z# d8 \+ y- M: e; Zif (iedom){
; j/ B! J) Z7 o6 F+ U4 mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 C8 H8 a# I3 C a& r9 ~cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
. R: w6 T3 u& m2 i' v% ~else* K7 o8 j+ z) w% W1 L0 M% y8 h
cross_marquee.style.left=marqueewidth+8
% a- H; U$ A6 X
( B9 S4 ^9 ?8 G% n8 F/ P}
' A' X, a, F: @: Felse if (document.layers){9 s3 r5 G6 l% n" I1 F- c8 G
if (ns_marquee.left>(actualwidth*(-1)+8))+ a* y. M" h: U# v$ @
ns_marquee.left-=copyspeed' I- V" l2 p4 V6 t/ ~% o$ ~: M
else
% p9 I- o& Q9 e/ m f+ I; a* K& Dns_marquee.left=marqueewidth+8- N/ G4 V6 k. M* d# _1 o
}6 u+ w/ s, R4 ~# K$ `9 h
}6 N D$ _% w* E$ T
Z9 c* L2 y9 Hif (iedom||document.layers){3 C& W* o# a# ?2 Q) q
with (document){" w7 R: n. V& D. v N& l9 I% d" Y/ P" t
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')* B: Z2 D2 |* _1 P
if (iedom){3 ]3 a. c+ S5 Z8 B
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' g) m( `1 S V& kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- ^; d' s5 v8 E4 z
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( Z. J5 `6 O/ w$ k3 W
write('</div>')5 O, B+ D/ r( N% K6 @
}9 e+ V+ w$ p9 |9 o) V
else if (document.layers){7 o4 e0 ~8 N! e
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' [; h7 @; \" f) _( @% kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- O1 e& w4 \" Y; [8 k
write('</ilayer>')
* ?, l) x4 g: R& v. ]& ]}, L, t: }! w+ c% F
document.write('</td></table>'): n# \ E7 d* m+ R
}) D- ^4 R: r/ A" z, t
}/ Q" k. x$ v; b9 ~8 Q
</script> |
|