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

|
网页之跑马灯文字特效
//修改宽度3 k/ w* `: Z2 M
var marqueewidth=300: |6 e' j3 \" W3 K8 e4 n
//高度! ]9 M& n6 g" t5 u) b9 S5 q
var marqueeheight=25% b0 P; x. n- ~4 u0 D" x7 e
//速度(1-10)
9 w9 O: h8 Z9 n1 Y- |var marqueespeed=34 k5 {/ ]% g" |8 Z1 `0 s4 w9 S
//背景颜色% C- g2 K5 O2 a; Q" u
var marqueebgcolor="#FFFFFF"" ?+ J: t' p" h) V
//是否能暂停 (0=no. 1=yes)?0 i8 i9 e: a4 v+ f% |+ \, `5 S7 k Y
var pauseit=16 h: ]2 u) w6 A; `9 C
% M$ V8 E. h" Y//修改显示内容# `% D) B. s: F* O7 M( c
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( M3 g& n5 L: J/ Z+ n, J7 J3 J! }& ^; {! U% p# h2 \
5 P: a3 I* R+ w4 \" A+ x
////下面不需改变////////////8 N1 T q6 h, q! E. g3 S
+ H0 x4 R7 f" ^/ J0 L) w) r
var copyspeed=marqueespeed
& `3 g9 y K) l( X, Q& o, b) kvar pausespeed=(pauseit==0)? copyspeed: 0
- s3 J; Y9 r/ W# l9 w; p, u7 Tvar iedom=document.all||document.getElementById
$ V# }# y r( o2 v0 mif (iedom) B* o" k' l- o+ n8 w8 ^- L
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
M' E# r H$ u/ m5 Tvar actualwidth=''
" E2 T0 p. ?5 nvar cross_marquee, ns_marquee
9 n5 d; U1 ?2 u! P1 Y) L+ o
. T4 i" m, s* c( vfunction populate(){. L* }, K. Q6 _& Y
if (iedom){
: b" q2 a ?$ \. l: Tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 }3 e7 J- _6 u T1 b4 p% X
cross_marquee.style.left=marqueewidth+8) K+ l0 I8 |" w2 X+ S/ G
cross_marquee.innerHTML=marqueecontent
: Q; r2 k* M& S( xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 l4 ~% c/ I- K% V1 W* i: o
}( b A1 K; D1 D/ p5 s$ i% S
else if (document.layers){4 V! s& I% [; _2 v
ns_marquee=document.ns_marquee.document.ns_marquee26 w9 \; u. V+ K/ C9 n$ [' E
ns_marquee.left=marqueewidth+8
; }( q/ A. u2 k' M# Z- L9 i; Kns_marquee.document.write(marqueecontent)
- N6 M/ x; i% ^/ Kns_marquee.document.close()1 L7 E8 P- @3 ?" B9 J, r
actualwidth=ns_marquee.document.width
5 Y% w: ]6 q& B}
5 h; q8 U) z+ D0 X* Flefttime=setInterval("scrollmarquee()",20)
1 S3 f! X* ]# J4 j9 F* g- L}* _# Z4 G/ i: j z! o
window.onload=populate
! b- Q# V, e2 `1 f5 z3 J
: N3 b( V( B: D& h- f: R& @: x# \function scrollmarquee(){
+ v4 [, N/ r! S8 h: ~if (iedom){% b9 z, E" a% D$ h3 d4 U+ j: A" S
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: U; ~- e, R9 R$ M& ]cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! W9 ?" L5 w. q" V3 X, o8 u9 Velse
4 v5 L) _" q, R2 \3 Ccross_marquee.style.left=marqueewidth+8
" B2 e5 p& n7 w: p( j: ?" l" ?7 G7 }1 l1 S1 Q+ E/ T
}
6 ^8 m9 \8 u: [) telse if (document.layers){
+ V, i f# I3 L) h6 Oif (ns_marquee.left>(actualwidth*(-1)+8))
& @# y! m1 [8 e8 K1 W# }4 Ins_marquee.left-=copyspeed- u" k7 ~& a$ C% o/ g6 U3 F
else! o0 f% [3 l; T2 f
ns_marquee.left=marqueewidth+8
9 I- A) X3 X2 _9 f( A( t; E4 ?}5 l1 z/ ~: A) E4 a o1 j
}, ?, M }/ @4 A* ^& J
3 t* F* W0 Y1 \7 y: x) ^if (iedom||document.layers){3 o8 m% h0 |' N& E {) I
with (document){! C" I% n) i5 o$ B; s F5 V
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% D4 v; @) v# H5 |3 k
if (iedom){
9 ^3 y9 j4 O6 D+ N5 \ Owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# g& z8 Q9 H( wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; C; w: w2 T1 H$ C4 u, f( [write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- ]3 x" E: A% s8 r* gwrite('</div>')
* m6 [9 L; ]& u$ e; u# q2 y# h}, q3 f5 [5 U& W+ l
else if (document.layers){
i9 Z% [$ {+ @& Owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ ?/ S3 K2 l2 y
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 d5 O+ s0 Y8 ? rwrite('</ilayer>')2 R. q& V; D) g5 y
}
5 y, y$ K$ C7 }- D" O/ Ldocument.write('</td></table>')' Q# \" G- ?; M. K+ B0 F8 y; u
}
, E2 r# C1 y) b1 C}
& C5 e0 g/ }/ C</script> |
|