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

|
网页之跑马灯文字特效
//修改宽度
% I$ |* q& o8 \. ^var marqueewidth=300
/ z+ Q! S' d [; M( l6 I//高度
/ A4 x: `, K3 o+ H% k! ~var marqueeheight=25
1 g W; ?8 R" y//速度(1-10)( `4 B, N4 P2 `( f6 F! m' Z Z
var marqueespeed=39 Q% y& t5 R; d, q/ c5 Z" G& }
//背景颜色
/ p; L' w. W; K3 i/ e9 v7 d6 Pvar marqueebgcolor="#FFFFFF"+ k3 u+ c: @1 c( V; r( X: O
//是否能暂停 (0=no. 1=yes)?3 h; Y b- R* C9 A7 T: K, R
var pauseit=1
2 X+ P/ ]# \" J6 [5 E) q% R6 G$ i' m" k$ S
//修改显示内容
9 r7 G* s% `/ ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 i0 j" s8 T# U, }! p- e+ ?) s& d6 R2 e3 P1 e' h, y
1 ]( M5 m+ j$ \6 d; f
////下面不需改变////////////- G; ^4 K% V' R2 ~7 M5 ?6 k
: e5 c1 D; Y4 b: M4 T9 ?# \; C
var copyspeed=marqueespeed
E. r0 p! \+ i. O& rvar pausespeed=(pauseit==0)? copyspeed: 0) F2 f' p$ K: K/ Z; u7 I
var iedom=document.all||document.getElementById
: Y7 I" t# a6 y: Aif (iedom)
) S7 k1 G/ L9 Kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" H0 ^. V8 u2 s R- F: _var actualwidth=''/ F7 f$ x$ O" g6 H/ c- T6 `6 m
var cross_marquee, ns_marquee
- J& T& Z( ]. B3 h9 V8 `
/ }. D3 n3 f3 }& ?6 Nfunction populate(){4 C8 U7 n( R P/ Q
if (iedom){; U; \: }9 u- M2 a" T
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: W+ M d; ?9 p% Scross_marquee.style.left=marqueewidth+89 s8 l8 Z, W- j
cross_marquee.innerHTML=marqueecontent6 S2 z' y: K' e6 h
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth' d3 A8 T. Z+ Q( b+ _3 O
}# R0 A/ i7 E, l& b, G! M8 g
else if (document.layers){+ ~+ z1 {: y% |: P: ]
ns_marquee=document.ns_marquee.document.ns_marquee25 l( A$ C& }7 ^! N0 L6 s
ns_marquee.left=marqueewidth+88 d3 t/ H- I! a$ K0 D, S0 Q# H6 _
ns_marquee.document.write(marqueecontent)8 ^ R# a; Z/ \
ns_marquee.document.close()' L P5 I* ?' P; _
actualwidth=ns_marquee.document.width/ `/ T6 ~: t# g
}* k }2 X# k4 n* K$ Z, r
lefttime=setInterval("scrollmarquee()",20)
4 ^" L- F0 J* K+ G4 d}* l; {5 `) e$ Q" W, Z* h3 E- K8 f
window.onload=populate
- C/ x* t+ V+ O! Y- \) @: ~0 I% `* V2 J
6 H5 f) [' n% c7 Jfunction scrollmarquee(){
' D. P9 O: J1 D; }if (iedom){# O! p$ N% l/ k# M z" w% c) }
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ R; e$ ^( |6 U! t+ |
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- \% H. V4 x, ?7 W! L% w
else
* X4 j# U7 b# p& n# \& a) ccross_marquee.style.left=marqueewidth+8
* |: l4 z [6 M( [, q0 d' m1 U, E+ j: x) C. Y* v2 x
}% c" n* H9 c% Y# h
else if (document.layers){. `5 T+ f' V) M, d& }) |0 ], ~5 @
if (ns_marquee.left>(actualwidth*(-1)+8))
+ M7 H$ I* j5 H" v% O/ Q1 C) q1 ]% f( [ns_marquee.left-=copyspeed4 y2 E- y- _9 l
else) Z. A0 w% N+ v. g2 B" n0 I
ns_marquee.left=marqueewidth+8+ S( ^8 H0 h m2 \ o
}
) T( Q) `2 s4 y+ Q5 B}
, k4 d2 o3 H9 x# A5 H% V
$ \% G! d+ `3 \6 L3 c3 Hif (iedom||document.layers){
% j" r0 I: }" _with (document){7 p1 }. n* A1 n/ Y n
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 P9 y/ k# \% K8 A5 O7 A( K
if (iedom){ l% u& f8 n: k8 f. q+ G+ R$ D
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 @4 j+ |/ w: G) U
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% M$ N8 ?& {$ k, R5 o- h% Z B
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" T# l! h+ Y q! e
write('</div>')$ y$ b2 Z# E6 O5 c
}
, v9 o! [- g0 p& K( Relse if (document.layers){# u. q6 t, i _- O, ?1 B
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' Z0 }5 A/ V0 F% E
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 c! |' f5 P- c2 z7 ^9 Y* Swrite('</ilayer>')
% a; l, u) Y0 r- r}
6 r8 m H! [0 V. w$ Rdocument.write('</td></table>')
& k8 C5 M+ n* v* c- g}5 z' I) R8 f# h: B5 p0 _4 J
}
+ E9 N8 o0 |1 D! y v</script> |
|