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

|
网页之跑马灯文字特效
//修改宽度
! W8 l& }) g* y( b! Q! @var marqueewidth=3000 P) m, D+ M5 x$ `3 T1 f
//高度" }5 h4 \. b9 [5 [$ u! W- o
var marqueeheight=25
8 l y) v" Z! |! w* ~' r* Y/ E" }//速度(1-10). \5 j9 s- u+ G( F4 U f. | ?
var marqueespeed=3
" e/ Z5 V1 F9 t: u) S//背景颜色/ J% s# \2 l. w a' Y
var marqueebgcolor="#FFFFFF"
" l. a/ |( E5 B; u0 m: v//是否能暂停 (0=no. 1=yes)?. B2 e5 G. M8 Q- R6 Q F
var pauseit=19 D$ X6 Y4 m# j$ {; x- Q
/ A# s, [2 _2 C! b//修改显示内容; O- X: u2 L( G f% g* M
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. \, \2 v/ h# O+ F
1 w4 I# A! R! e& f
* k* n' E6 L3 U0 T3 V- T
////下面不需改变////////////
+ q2 [: f! j9 f5 W7 |0 Z$ ^6 V1 j. w/ h/ o$ @# [
var copyspeed=marqueespeed
3 u! C. T. D; f4 b* ]var pausespeed=(pauseit==0)? copyspeed: 0
4 r9 m# x/ o$ l' |, z4 Pvar iedom=document.all||document.getElementById
# _* l7 Q, _/ r, p5 Q eif (iedom)$ V* @! o$ y( u# d U1 i
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) Z. \$ K* H$ ~* wvar actualwidth=''& n/ M" @. [* N" n/ t2 h
var cross_marquee, ns_marquee# l$ p9 F. N$ N7 J
6 |8 }$ w4 [4 v3 p3 A! R7 r* {" K8 qfunction populate(){+ Z. Y" p& Y& o ~. n
if (iedom){4 v6 _" @& s% L; J; B
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 V, @" v1 o! w4 ?$ U% g
cross_marquee.style.left=marqueewidth+8
$ G! V# f+ E! {8 w; v4 ?% ]/ E$ Qcross_marquee.innerHTML=marqueecontent
) D; I3 O8 {0 y# P3 k" Nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ m- ?- X9 C/ T% b$ n
}5 G7 u- G+ l; S( M( c' G2 x3 A0 V
else if (document.layers){
. W0 D/ J" I" Y F4 Y7 ins_marquee=document.ns_marquee.document.ns_marquee2
# }4 F1 o% h' H0 H) g. V' N0 ons_marquee.left=marqueewidth+8+ t8 Q/ R; {' S) j( t5 ]# I7 g
ns_marquee.document.write(marqueecontent)8 l& x! t9 m8 C& B- d
ns_marquee.document.close()
D; ?! F# c4 b+ y% h& l# Aactualwidth=ns_marquee.document.width8 n+ Q8 I. b7 y# ], b( x
}$ K3 g) M2 p" b0 [9 V* L
lefttime=setInterval("scrollmarquee()",20)
3 A3 A" f' |* U} Q' g, R* U/ B' h9 _* u
window.onload=populate
, T. {% o2 w0 J0 N
$ E% b/ ^9 N2 u( Ffunction scrollmarquee(){% n( k$ o/ d! u+ \! _$ Q: j! I
if (iedom){
7 y5 @% ?/ @6 W P% v% q8 pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), f1 d; o M# d1 c3 F8 k$ T, R
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 C- ]( y; Y8 t
else
; @. A/ O; H5 `; q. I. _) Across_marquee.style.left=marqueewidth+8
- w% U- F# c, z9 X9 s8 Y" c1 g. u* |1 o8 M* u; W
}: h4 S" y! @7 o$ Y) \
else if (document.layers){
& ?$ y# v# b. h6 ^) T* r7 r6 H; mif (ns_marquee.left>(actualwidth*(-1)+8))
0 ?' m9 l! X& @ lns_marquee.left-=copyspeed$ _$ N5 h E9 B% a4 I3 l
else; H7 C# p" R9 C6 p0 X4 k
ns_marquee.left=marqueewidth+8' e$ ]2 _7 A+ J% X3 p
}
, j* n. O1 E& h8 H' H}
4 @: `7 d( h% s0 P& J
2 U7 n* F3 V5 `6 z. C$ ?if (iedom||document.layers){) A1 L1 V) s# U0 Z* s' L% ]. E
with (document){5 s* k+ q0 t: Y$ b, t: {" B
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 r ^& W4 w$ bif (iedom){: l7 E, C: z" o% h+ D* m2 A9 _( v
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* E3 g0 V1 A& D4 }; s
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( V4 ?2 \3 [8 F, S- k. `/ V
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 ]: \- |/ w7 L# p @0 ^# awrite('</div>')* l( G8 P' F, @2 b' U& p3 d5 e7 T; n
}0 \$ i; Y% H& Q6 W
else if (document.layers){3 ~5 f! H2 g) m4 X. r s5 ~
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ J$ b7 ~3 Y+ T
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 u/ J3 Z/ l6 r7 g
write('</ilayer>'); a7 |- e- [1 p u
}
4 ?- l, Y- B0 t( B bdocument.write('</td></table>')
) j y5 g% J0 y" u}
/ `5 x% |0 K4 [, d6 j0 c- N, @8 s}
$ S( a0 i P8 }2 a; q</script> |
|