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

|
网页之跑马灯文字特效
//修改宽度
S8 W! h; h, [/ s& Bvar marqueewidth=300
# j) j0 F# A4 }//高度! r# ?7 |0 ?4 Y3 F
var marqueeheight=25
+ G( K$ p! r/ L7 e. V) S( _( K R) b//速度(1-10)
& J0 m' O8 h6 t5 [4 Z. Qvar marqueespeed=3
. h+ J% [5 j7 x% J. `% {//背景颜色) G& @5 W; Y' R( O. U1 t
var marqueebgcolor="#FFFFFF"+ V+ V; e3 v4 e( H2 j, D
//是否能暂停 (0=no. 1=yes)?) p* P2 `5 P! P, _
var pauseit=1
1 i: r7 {1 V! ]* P F0 [1 j* R2 l1 P- A% U
//修改显示内容
v5 @6 p- N# K6 Fvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# Y9 c/ i/ m- ~$ [7 m+ Q% k- U& ^* l+ A! C0 U3 a- U6 m3 Z
) c1 H* Q+ K0 R6 V1 \: `) F( ^////下面不需改变////////////5 T) s0 x: G% H( X% y
2 I$ c9 M4 S/ g" k; j% svar copyspeed=marqueespeed
3 e2 O& _% P/ z: G! ]var pausespeed=(pauseit==0)? copyspeed: 00 T0 j' n0 P% y+ |8 s
var iedom=document.all||document.getElementById/ N: Y6 I' \ j& Q' |& g- z6 \3 Y
if (iedom)* Q$ C* j! @" e" W
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 P" p* H# _( D/ a
var actualwidth=''
$ X. [' Q0 v# C8 p3 |; ^" t, nvar cross_marquee, ns_marquee
- a: B- j' ^- [1 c6 P$ [$ d& B; f. W& x) g1 k5 V% E
function populate(){
2 G4 d/ w- r5 G' ?% `# Qif (iedom){
8 ]3 m6 T0 ^6 }. Icross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ J% k. c& f, T; S7 L2 [: Scross_marquee.style.left=marqueewidth+8
1 ?5 W K# B% B/ O% @! ^' Scross_marquee.innerHTML=marqueecontent u5 d0 H* Z+ d; N* J. G0 n3 D
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ E; g+ [! V7 a. b" p# I}4 D& Z) [0 ?1 k& Z% Z; `) ]/ P' Y
else if (document.layers){
! h% v+ U5 j. Q% N/ N; nns_marquee=document.ns_marquee.document.ns_marquee2
! H# W/ F: Q+ @) bns_marquee.left=marqueewidth+8. I- G7 C+ \; u( M8 e! M
ns_marquee.document.write(marqueecontent)
l" C; w' e6 _& Zns_marquee.document.close()
: A, i l9 r+ t) p qactualwidth=ns_marquee.document.width
' [ [: C2 K# q7 o5 T* L}
! x( T4 n) | C8 J" y. c/ llefttime=setInterval("scrollmarquee()",20)
. E; z- H) ^5 P0 }$ N}! B- n Y# g. ?& i' h3 ^; S/ D
window.onload=populate# i9 |, s1 P- q% i" F' z4 i7 t6 q
$ D6 B0 a: `8 E6 q$ k3 Nfunction scrollmarquee(){. L2 ^! v: g* \: w$ P) N- H
if (iedom){# [# H; Q# ^* T' x* W, ?
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* ~; G F8 D/ z; a
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# k$ I5 c# s. selse3 [4 ]4 s+ V t
cross_marquee.style.left=marqueewidth+8
# O# c, F H; n: C
- K2 y& S1 M: e+ S/ F1 N}( c3 b, N9 @& `, x
else if (document.layers){: q* z2 n w$ `. B$ U
if (ns_marquee.left>(actualwidth*(-1)+8))6 m1 j( V9 q% G( v9 {' h2 r" L x
ns_marquee.left-=copyspeed# d# M- v+ Q, P" x. ^! W# I- {
else/ Q# \ ?" V% t& F; B: ^
ns_marquee.left=marqueewidth+81 F+ H8 C6 ^+ C# S& f+ a
}& n" D( i1 r# g2 o! g
}9 I3 S! l" M$ c2 u/ V
q" L9 i- E) u5 d; Q- v; c# H, Vif (iedom||document.layers){
6 e5 K4 m2 x3 Z7 q1 kwith (document){
/ {2 |! `: s( @4 j( y1 h: n3 Fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) }6 V* \ D% R/ q2 e0 s9 _2 dif (iedom){
. W, }, V ], b4 @' swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& D* i3 g3 H+ w/ X9 t" N. J
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 D# R" A Q+ p/ K) C
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
2 {+ E: M, P# Y5 O: v& \write('</div>')
: f* M4 m" q7 F; ?+ u}
, }1 f Y) }+ g4 o( s1 W* velse if (document.layers){0 l8 K3 S( L ?/ ~# e1 o/ ^
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')0 U6 A! f1 k! {& N
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ U; o+ U2 G* w$ i3 J! S6 v
write('</ilayer>')
2 ~9 \3 A# n7 L0 D& k I- _4 B' H0 @} _9 [/ g `2 @
document.write('</td></table>'), g( \5 N; Z) @/ x8 Z( `+ T3 i8 _& b
}# \0 A/ k) d% s5 ^ ^5 f
}
2 E) ?: O0 ]- `9 c4 e</script> |
|