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

|
网页之跑马灯文字特效
//修改宽度
8 ]2 x8 E& ~+ b" D* c7 a; T& B, Jvar marqueewidth=300
5 K8 ?0 z* i% C) F$ j- t/ b//高度4 c- N( T9 o7 v! W3 t9 ]0 B
var marqueeheight=25" c! i2 S n# c0 a5 B
//速度(1-10) V( W1 l3 s0 s. \0 R
var marqueespeed=3( y [8 n7 A0 I
//背景颜色
0 X, a; ~9 u5 ?0 F5 Avar marqueebgcolor="#FFFFFF"
6 f8 D* t& O, c4 Z//是否能暂停 (0=no. 1=yes)?1 d1 M1 Y D) `+ F
var pauseit=1
2 |5 s# j: B0 M
+ A9 A5 X4 }, x8 h//修改显示内容
1 N& Y- e3 S! I& e& _: q6 I2 Evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# [- Z5 L4 q+ m+ N" m7 i @' t& j5 M
! E6 X% F% }7 h1 G" _
////下面不需改变////////////, o1 |; u) r u4 u- x
) R3 e7 ~8 o$ m3 K/ y; U
var copyspeed=marqueespeed
5 X. Y/ x$ I; o [, ~4 ]var pausespeed=(pauseit==0)? copyspeed: 0
+ e8 P/ I6 ?1 L+ I* W) Fvar iedom=document.all||document.getElementById, }% {8 |6 N9 _3 W6 O
if (iedom)
3 e9 b7 o4 c6 e) e) _! \9 e1 |document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 l& `# f' K9 y9 T+ |5 Z, g9 T" i
var actualwidth=''
; c" C5 J8 N- d w! y f$ Vvar cross_marquee, ns_marquee
0 t; K1 j1 ~! ]$ ?, m' Q5 x. M4 b: V6 b; f& I( J" X
function populate(){& ?- S5 L# S7 J6 j# [7 u4 w' y
if (iedom){
1 y# V$ ^/ R8 vcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* K0 j4 |) P1 Vcross_marquee.style.left=marqueewidth+8$ K. K0 G- e, r% z2 Q5 B) k) D
cross_marquee.innerHTML=marqueecontent
1 N7 s5 [- O. c( J/ f7 Aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* z; V8 M& ^+ g3 J7 H4 E+ D# U
}
, r0 ?. d) Q5 Z% o3 ]# f) j6 z2 ielse if (document.layers){
) c2 r+ |+ t+ y1 Lns_marquee=document.ns_marquee.document.ns_marquee21 r3 [4 ~5 ]" }, W
ns_marquee.left=marqueewidth+8) L( ?- B5 F. ?! g5 o
ns_marquee.document.write(marqueecontent)
- i8 g2 K) X+ s8 B, i" u* Y2 uns_marquee.document.close()
# i; |8 M- P8 j1 Q0 B) @/ |actualwidth=ns_marquee.document.width+ e3 D, s( Q% n9 D1 Z$ N
}; _/ w1 Y* D3 K, h3 K; |0 ]
lefttime=setInterval("scrollmarquee()",20)0 G$ X# e9 H: [ n
}6 L- t+ M5 e& \) ?
window.onload=populate: r: _0 E; p8 }% V( L
; Y$ W9 [$ n$ v0 Efunction scrollmarquee(){
7 t Y# O B' T6 u/ ]: O7 S2 pif (iedom){- a% Y" T/ E( U1 O- y3 A) t
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). A, o$ h( R; Y3 R6 J: J
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, s) M4 T. {3 @! o velse! z$ l8 F+ o5 D1 \4 R. B% A; f; j
cross_marquee.style.left=marqueewidth+8/ i4 s$ @7 d; t1 ?. t+ \
' w9 L( q+ E$ x. ~% i' I% ]
}
* G S5 J# r. N, Oelse if (document.layers){- T# H, K4 g/ g
if (ns_marquee.left>(actualwidth*(-1)+8))
) z* y; p5 C# y* qns_marquee.left-=copyspeed
6 t5 Y% r8 O$ [! [, P+ E% J! Helse/ i: |% ^; D7 f7 T0 `; y
ns_marquee.left=marqueewidth+8
; ]7 p- R* A. {" T) L. E) o}
5 J# x* i0 H) K/ ? Q0 q) z7 e}
. }. o# b& Z/ j$ G0 f& e. P1 x1 [ J3 ~% ?+ m7 S b4 `3 E5 y
if (iedom||document.layers){0 N1 H! k1 P8 \7 | S
with (document){) a3 C+ b9 g4 C$ Y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( j0 l9 Y& `. R/ v+ ]/ i! j
if (iedom){
& Z" A" C& g Y: d1 H r9 y: Uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& S8 z; L5 c" U* u6 Iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 ]6 s9 q n% l' W4 Awrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>') I/ R+ ?2 x; Q$ W' }
write('</div>')# x# B! i# T! S1 G( W, J# L& {
}4 C1 d' U- w( c; S @
else if (document.layers){6 L, G* T3 B% I7 L! x' T8 m
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 ?, \9 g2 g# u" |/ d; k
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 A% ], x' h$ _6 N0 ~write('</ilayer>')
) i0 Q& J, i, J7 ]' }}7 |" Z; q/ R! _% _1 ~3 o% T: S
document.write('</td></table>')) ~' K6 V" U1 ^0 P: K+ a Z
}3 [" n# v( X2 b; t0 ~+ M2 @0 K
}! h) s5 M/ B( n: L/ A% u0 B
</script> |
|