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

|
网页之跑马灯文字特效
//修改宽度! N2 A* G ~/ i; K
var marqueewidth=300
I2 _1 }. E# j& ~6 ?3 J: Q//高度
8 A9 X/ l9 I6 I: V5 A/ G2 Bvar marqueeheight=25
8 v" M( c( n0 b" D: }) \$ Z//速度(1-10)
* U4 ?% k- j$ {6 kvar marqueespeed=3
. O& q7 }& I' A" G, [( G& c//背景颜色) o5 |( L- d# b% e7 |0 B' z
var marqueebgcolor="#FFFFFF": Q8 e% _) I8 i' v v
//是否能暂停 (0=no. 1=yes)?7 C0 m \! Z1 ]
var pauseit=1
# c( f, \" o v1 p$ B3 D! L$ V1 Y; G2 x
//修改显示内容
% K P. ]- b- Rvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# q/ h: B, u, e6 k; m3 f0 T% |
: t/ i3 N. K- \6 N8 H# ]6 O$ _
, r! L/ r9 { Z" r. C H' A8 m. B////下面不需改变//////////// g4 e; |2 X& S9 J% ~: ~3 z) x5 z
2 X# W+ Y. N% Q. h3 {7 _4 u4 |
var copyspeed=marqueespeed
: m3 i$ u* w+ jvar pausespeed=(pauseit==0)? copyspeed: 0
9 {+ u9 [8 K7 ~+ n: Z) Mvar iedom=document.all||document.getElementById
0 I. n5 r9 b1 l4 { o4 kif (iedom). A1 |! E, T0 x$ @% J9 W% {; H
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 O) ^- D5 j6 [, hvar actualwidth=''
" d& C4 K5 N% F; C6 C7 Pvar cross_marquee, ns_marquee2 ~0 v+ J7 M( @" z% e1 d
1 u% @2 d; K3 p: l) Ffunction populate(){- m& v1 E4 k! g% I9 d9 O
if (iedom){% z2 ^. {0 A6 b- C M5 p9 ^) X4 z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 Z: x, T2 C2 {& N0 t9 S/ x0 i5 @
cross_marquee.style.left=marqueewidth+8: O) [5 g- C9 E
cross_marquee.innerHTML=marqueecontent
3 t& }3 k! y2 [% y: z0 ]6 B8 Bactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 O" j7 c& A$ }
}) M2 }5 D, k2 s
else if (document.layers){
% G, P% }- d) n5 x6 V& v1 l& G% c `ns_marquee=document.ns_marquee.document.ns_marquee2
1 L/ P, `$ N4 P: bns_marquee.left=marqueewidth+8
# H- z4 P! r5 H$ k# Kns_marquee.document.write(marqueecontent)/ _/ i/ I. P3 I
ns_marquee.document.close()! j) f+ J6 q9 [" U8 F# v$ s
actualwidth=ns_marquee.document.width
4 {, K2 I3 c, o9 U, k& Y U& ^# N}
+ C, ]/ E7 P1 r- k$ [lefttime=setInterval("scrollmarquee()",20)
]4 g1 R S: y8 `5 C8 F4 `! K K}
s; C- q% `# H9 Z; Rwindow.onload=populate
7 r: p& b! i a
2 {# k5 x' u) z2 x, V9 Q7 Ffunction scrollmarquee(){
! K4 U& {: Y; {# t. X$ fif (iedom){
) O, y2 s0 h. J9 l' w# h1 Mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" U; n" w6 ~* l8 Z$ s7 _- R$ w9 W( Dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ j0 i! u2 C* r6 G* e
else4 C1 g; D) T# w, s$ u4 u7 w, L3 l
cross_marquee.style.left=marqueewidth+8
, o) Z& K& R. Z% O: t6 }# a
2 D3 a @% f! _6 r# U}( I- I N# J( Y0 }* L
else if (document.layers){: d) T8 M* M4 x0 z% `% c
if (ns_marquee.left>(actualwidth*(-1)+8))$ h1 [, e3 q$ s" H
ns_marquee.left-=copyspeed
# Z }' i- x4 w2 Xelse# Y4 u* L; y7 |# E8 a
ns_marquee.left=marqueewidth+89 G0 h: E+ I: b; j* m' M
}. z3 T% S# K V9 U
}
3 [2 v* r+ F' s1 X- A$ T8 Z
3 N8 u( V; [" K8 v8 ^4 U0 Qif (iedom||document.layers){
( ]$ e" Z3 K( I2 D" G2 Swith (document){
6 I/ b& V) X3 s) u K9 Xdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# {( Y0 _/ g6 n& V6 n! p! [
if (iedom){
6 R+ w- M6 m& hwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% {* ^3 K& v4 r9 j1 c* Rwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( l- o, [! j8 ?1 K6 S* \
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), c; t2 K% X3 _
write('</div>')
6 q4 G; T- m, W# Q; x9 G}8 Y& Y/ k" f6 d! k
else if (document.layers){" k# H7 T/ |0 i! z" O
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 ~2 R3 O0 F' I2 c e3 Kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: N9 I, f8 ^1 p7 H' Y7 Iwrite('</ilayer>')& @7 t1 D1 P' b9 B5 Z
}, P) i% v/ Q, E# c. T3 p( ~
document.write('</td></table>')8 Z% K/ \7 u1 @" ] ? P" M
}9 H, X( r7 p* V0 E3 B
}
; w: {0 L( s# \* d2 ~6 V, j3 L. H</script> |
|