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

|
网页之跑马灯文字特效
//修改宽度
9 j# l3 e7 T3 g9 ~( |3 R D3 _* cvar marqueewidth=300, l3 `+ N+ l, }4 ]$ D' W( y
//高度" i( z- h, S4 O$ e& a
var marqueeheight=25
' e' T5 D% r# e& _& p2 q//速度(1-10)# V) h1 Q* b! N9 y: x
var marqueespeed=3' O7 Y. J7 Q% x+ b* i
//背景颜色
! \ F. i3 K( Hvar marqueebgcolor="#FFFFFF"
6 t% `4 U: X4 n) s: `% U. Q2 N& I//是否能暂停 (0=no. 1=yes)?
% r2 @1 [ E2 Z3 K9 Svar pauseit=13 C1 e3 Q: |/ [) C. U3 ?$ p5 g- }
+ ], w/ L/ Z. ~2 ~" P: x//修改显示内容
) Q& ?+ ?) x% }* Rvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 h( k6 x! m1 _# t
0 w0 j! T- f& j; f: {" X
% T+ {2 G. _) d; t j////下面不需改变////////////
6 z; E; I+ c+ S
( Z7 U0 X- C; a* e; Bvar copyspeed=marqueespeed
7 g- t8 A# Z1 h0 L: z: g- G* `6 @$ xvar pausespeed=(pauseit==0)? copyspeed: 02 z$ S5 }& ]5 \% G: w& m/ Z
var iedom=document.all||document.getElementById, }" c; U8 Q" k4 ]" ~
if (iedom)
0 c1 x+ ^( U1 {7 C0 Adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 k: L: U: h4 O2 y
var actualwidth=''5 d+ M" t! y& [% J6 |
var cross_marquee, ns_marquee
& ]7 g4 u5 i! }4 N: U# V \! E5 G4 x# O0 y* [
function populate(){# A+ h6 R; P; E; t
if (iedom){
* F2 u- n2 |) w8 H, j! hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 V. ^2 M% O2 W; o7 E) B$ {cross_marquee.style.left=marqueewidth+8
: C) D, f9 U/ ~2 I+ pcross_marquee.innerHTML=marqueecontent
% s# Y3 b* j* _, C. W2 I3 factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth' i7 B6 o4 |' x" w& D( d: c
}- A( b1 E* _5 K
else if (document.layers){
0 [2 A3 x/ u. T6 Y% }ns_marquee=document.ns_marquee.document.ns_marquee21 {6 n( G6 A( R- \! d! s
ns_marquee.left=marqueewidth+80 G- K v& g" k; \: w) ]" i
ns_marquee.document.write(marqueecontent)3 I3 k0 q3 B, {& V$ x5 d f
ns_marquee.document.close() F$ h( Y9 @3 p* K! Y: P9 A
actualwidth=ns_marquee.document.width
. a8 h+ Z, z7 X: J( {1 x}0 r* x8 l& F% V/ M0 g, t+ h& l
lefttime=setInterval("scrollmarquee()",20)
0 Z6 }( I, G, a* L' Y/ b+ C1 m}
* [7 c( y. e* f# K& rwindow.onload=populate0 B( s. I; v/ E' l3 P3 q' g
9 G! d8 N5 {4 s8 q. @8 K# ffunction scrollmarquee(){
8 m2 \ q J0 M2 Rif (iedom){0 n2 n* @0 `. R9 ?: E4 f
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 K# M* }/ Z: x0 w+ G. Z: ~$ Kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ a6 K: {9 ~" b4 D
else; d8 L5 z1 I! X6 C# N
cross_marquee.style.left=marqueewidth+8
; _, @9 K' b/ y6 V" q9 w( W) c6 y0 k. n+ p' E! Q2 q% I
}% N! [( \- H/ F6 s8 j" d& p
else if (document.layers){' P7 n/ b. b. W5 E* x0 I% s
if (ns_marquee.left>(actualwidth*(-1)+8)): q3 f2 Y4 J- u h8 e0 s) Y: O, I1 d
ns_marquee.left-=copyspeed) ?" U; r: N1 m
else [0 z, Y: T! B, _2 c
ns_marquee.left=marqueewidth+8
+ Y( l `7 f! N! p1 G}4 n4 S# U5 r# x
}
3 \. B, f6 `5 P& ?7 g2 I" I( N- h2 |, t
if (iedom||document.layers){
0 O8 `& D3 @5 C5 Twith (document){1 x0 T0 P2 `7 c f2 c W
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')' F1 F6 S7 p5 h/ U2 O, i% l$ D5 n7 n
if (iedom){- |6 {$ `3 ], a7 _. K$ N
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')7 Y# ^: T5 }* `' Z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; r) t! e: h1 G# a! v% }write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); I. z; k( K- C! P# m$ R% Q- n
write('</div>')
, W4 X& w' \5 M4 e% J}0 }5 d+ W& u) I6 e7 c
else if (document.layers){
) @. z C, O0 J( _write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ S% z: y' Q- N: |* M
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" t9 }6 a/ A+ R" L" z& ]' T) Awrite('</ilayer>')
2 e0 f3 W& ~ A) r9 v3 v* e! _}0 g0 m) H* M% H: Z: K) K4 }6 M/ r! Q8 W
document.write('</td></table>')
2 O" d! M+ f+ R6 g}4 [. E, F3 W2 g- i
}7 q5 g& A; z( n
</script> |
|