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

|
网页之跑马灯文字特效
//修改宽度
- t: E0 M# i. U) vvar marqueewidth=300& E" m/ S/ K2 c! `, k" |2 C9 m0 u
//高度4 ^$ ~- O, q; `3 U0 b
var marqueeheight=25
$ J. t0 @) c3 I, ^$ q+ A3 M//速度(1-10)
8 ?- |+ b9 t1 F# J( J5 ~var marqueespeed=3# A9 x) E" R) B
//背景颜色/ Z* i, v4 P$ u: U6 z! Z
var marqueebgcolor="#FFFFFF"( Q8 f* V9 v* x1 F( |8 K* [
//是否能暂停 (0=no. 1=yes)?
4 A% P: [9 p" t4 ^/ rvar pauseit=1
: P) m9 K6 T# L* s: k' A V# L7 I3 i7 r9 F* e
//修改显示内容; ?8 b+ e. N5 n' U. C
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' d# F9 E! q7 |9 F Q; y
0 Z* }6 d' _& {* |/ `* K5 ?: n( O9 c p5 l0 s$ \% k( F4 N- `. r4 d
////下面不需改变//////////// K j3 ^. Z# }4 M7 L7 g- {
& `/ W5 M$ g" l4 k$ P" Z+ u& s; Cvar copyspeed=marqueespeed
( I2 n# R( Y4 rvar pausespeed=(pauseit==0)? copyspeed: 04 j) ?: J: _% e
var iedom=document.all||document.getElementById
% ~5 e X! V- J. q, f: Zif (iedom)
3 H3 j- t h4 L% U5 w! F$ X+ Z4 adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* E( p3 l& q# M4 l
var actualwidth='': t0 W* P6 i' m
var cross_marquee, ns_marquee
" p# x5 [( V/ s% H6 d
' K. M. ?% K7 G% s0 b" ~$ _, yfunction populate(){% f: V3 c% D1 A9 Y2 a
if (iedom){
0 i/ {2 V4 V6 I8 G3 R, Ycross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ Z: q. }/ | Y1 g; h9 d; ~cross_marquee.style.left=marqueewidth+8
; a: X: q4 Y0 Q R( Rcross_marquee.innerHTML=marqueecontent. T, I: J. V6 w
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 |2 N% k2 Y6 E) o) ~3 ?, `; G
}
: g1 w" \8 \1 `5 Telse if (document.layers){
1 ]4 w2 A: p0 D; I* V5 X T2 o2 Q; o& Rns_marquee=document.ns_marquee.document.ns_marquee2
6 T4 {) W/ _- t% x! ^5 `7 v, qns_marquee.left=marqueewidth+8
C" h' j" s$ ]- ~% M2 Ans_marquee.document.write(marqueecontent)
! s+ r7 H8 E. m3 V- b# Ins_marquee.document.close()( b W" D$ R* ~+ X+ |
actualwidth=ns_marquee.document.width& }0 P y4 i; S
}
0 o, M. D4 Y& `: p9 {' J- ilefttime=setInterval("scrollmarquee()",20)
1 c8 p! n+ Y; g- Y}
+ s+ |. g- {. E0 f& I9 _% l: {window.onload=populate2 g7 Y w" J. A2 V
: u! O0 E* ]: D! S+ Nfunction scrollmarquee(){
- E, z6 X# Q) I* ?- R* d1 M( pif (iedom){0 Z- v* C& v& b& U
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); p8 w8 g+ e q; M6 S6 [
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 z2 C4 _8 d4 \. w& ]* ` J
else3 f+ r! h, j. k5 J
cross_marquee.style.left=marqueewidth+8
6 E- J2 N6 @+ G& j6 Y6 K' }& Y) d: ~( A9 v6 M& G9 I* M
}
# r$ h( y# }! g, d$ z" u7 Welse if (document.layers){
3 @4 R$ u5 {% C" yif (ns_marquee.left>(actualwidth*(-1)+8))3 k8 X; C: ~6 g1 Y' d
ns_marquee.left-=copyspeed) B7 m( U1 P4 { q9 S
else
$ ?& Z4 G, Q0 f( b1 t% h% Jns_marquee.left=marqueewidth+85 B/ x3 J) D+ I5 l) ~
}
, K+ d7 g# k) D3 s}+ I5 m! M6 m! E3 n2 Q; _, B# t9 c
) O4 n3 `2 g& D2 w$ Cif (iedom||document.layers){
1 O; t% l5 W' q* j' T6 x& qwith (document){
) v0 u6 D3 f% Q" d/ ^document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 H7 ~$ k' ^! B% k1 x
if (iedom){
. e) J, R+ E0 U; q owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" k$ _* _! l! }) Y/ I- u7 a* K
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 _1 `+ X* c* Y. Q0 {7 i4 Pwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% C% w7 w6 u8 R4 c Q) I2 n/ \write('</div>')
' C$ G$ J+ \3 a5 w- b9 g}# k: K' |6 h9 a; A
else if (document.layers){
- {/ t7 u+ M4 U4 r e0 G% U5 a' Y: ] j, pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ _+ o/ M8 X- s! x* }: ]4 N7 E. ]
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) {8 u" ^: O3 ~9 n9 P$ pwrite('</ilayer>')0 m) i+ \' y! ]
}% s- c8 K$ D, D, _- Z( v/ R$ h
document.write('</td></table>')
( A3 J( u. z: A3 R$ {+ { g}
2 s. G: L8 |2 z}+ l# v M2 z2 M0 j. r& G" E' _8 _
</script> |
|