返回列表 发帖

网页之跑马灯文字特效

//修改宽度" j! X% r8 [* i5 k( A3 j
var marqueewidth=300
( ]1 x; \# H* f//高度
: S0 J/ f; E2 X) ]var marqueeheight=25+ R" h- p- I6 J( y) F8 a
//速度(1-10)
- L& m3 a1 t. d9 Rvar marqueespeed=3
/ h% K$ s  p5 N& V( e//背景颜色: w- t+ ^4 f& }5 j  A
var marqueebgcolor="#FFFFFF"
' y- j! Z7 k  B3 ^, s//是否能暂停 (0=no. 1=yes)?8 I3 G+ Q! k$ M; Q1 z3 u+ b9 x. t; ?
var pauseit=12 j9 Z% D& ]8 \5 y

1 Y! n/ j/ n! M( f9 D//修改显示内容$ z5 Z" i0 k6 N- u* `9 B, f
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 o" @% B4 \7 r9 h4 w
1 x1 N1 B; l8 |: H: v1 E# l* f6 D# ~: q
////下面不需改变////////////% G7 m: v) h( h2 |( W9 F
" _( R/ J( |0 E4 t
var copyspeed=marqueespeed3 e# Z( T8 H, S; l# d) t
var pausespeed=(pauseit==0)? copyspeed: 0
0 ]/ d1 r# X/ _( @: Ovar iedom=document.all||document.getElementById
; J7 x5 \! X/ H7 c0 r' G& A! cif (iedom)
: `2 i. E( O; A' t. v7 zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')( H0 F( C$ O+ C' l/ a
var actualwidth=''
- q; B! l# E* T& Mvar cross_marquee, ns_marquee5 S6 f! v3 i$ n4 M

# v$ U0 t. M; f9 ~( pfunction populate(){
1 {8 K; [0 |8 l  Qif (iedom){6 o8 @9 \5 U3 _
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; |) R( [) O0 y2 o; @4 f5 Q, b1 {& \) A8 ecross_marquee.style.left=marqueewidth+8: K& M. x& r  t4 u6 Q
cross_marquee.innerHTML=marqueecontent
5 w9 q) Y  V' @3 }3 s( Mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; a) T: k4 P; A' _7 B) `}
- W) F( ~$ V/ ?0 P4 l- {1 ~8 zelse if (document.layers){
3 B, ?9 C. m: q6 E9 {2 Wns_marquee=document.ns_marquee.document.ns_marquee2% `$ E7 Y$ y6 O; w0 K; \! X' G, q
ns_marquee.left=marqueewidth+8
4 T$ h+ o5 I% r. \  @3 q. Q7 w2 Sns_marquee.document.write(marqueecontent). A$ p; x, x! ?4 v1 a
ns_marquee.document.close()
6 m- N; o5 _! r! K6 [actualwidth=ns_marquee.document.width/ x, w* R. t# @) L& `+ F, b
}
) i7 q; s4 r; y. I* b# r- nlefttime=setInterval("scrollmarquee()",20)
% v' a3 v" I" A, V; A}- y1 l# i' X' q) \
window.onload=populate5 b5 [. D5 H, d

$ h. }$ j$ t; O0 v$ cfunction scrollmarquee(){! B: E, a4 O7 F) k! `% G
if (iedom){( Q# J0 I& c& F$ p/ @
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% h. a9 Z9 k$ z8 K$ s$ ]" ^
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* m# y/ s5 Q* B- ~, ielse6 o' P7 W( p  g+ B. S
cross_marquee.style.left=marqueewidth+8
3 u  Z+ p7 u! y2 P( e% p: V. L* L3 H
}
8 v1 @  W, Z. d- ]6 S0 ?& o+ B) \else if (document.layers){$ U) u. F' N5 S* l# s. }
if (ns_marquee.left>(actualwidth*(-1)+8))
( U: K1 p! ^* E( c: o; Zns_marquee.left-=copyspeed- j7 y$ {/ l! W
else5 p/ ]% r6 \* S8 F
ns_marquee.left=marqueewidth+8
" q: N5 L: J/ d' Q}
. x' M  o# {+ U) m; W, i8 q& Z}
# z, T6 p; ^! E
. q" f4 l! D, Q6 Z! t' Zif (iedom||document.layers){! }/ U0 w) r& O
with (document){
( q, e& A- N! q$ X" m3 i8 E% _- L+ Idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) _0 ^3 b5 K0 f  M4 o: s' t& eif (iedom){0 P3 F( ?7 X  R1 J, I4 Y% d" q8 M
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" o- {: b8 g" I9 ^. L
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), R" g! S" G  I4 M0 O" Y
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& w7 y8 n" C4 D; E9 owrite('</div>')8 R. K) o* T3 k$ T7 u
}! s8 ~( r: ^6 f: H# q, O
else if (document.layers){* G8 `2 m" y0 P* k/ R
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ ?) y0 y' l# M- |/ ]( d3 J8 O0 Zwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% B' e% _9 ~& t( P! D' l; N! c# `write('</ilayer>')
8 e. [0 d  p6 I2 ?1 V8 n( R& X$ ?1 ^}8 c$ ~; `! x! s6 E6 ^/ M* }3 Y
document.write('</td></table>')- ^6 m% L; i4 }! L( b
}, I# D* F+ J/ u. Q
}% c% x- u; H7 _* h' w0 P
</script>

返回列表
【捌玖网络】已经运行: