返回列表 发帖

网页之跑马灯文字特效

//修改宽度
: Z4 O7 y1 V3 Z0 V% Z" }" R- `" Pvar marqueewidth=300+ G. @- l7 v: p
//高度0 @$ }0 p7 I' g( M& x. l0 W* b# d$ U
var marqueeheight=25( J/ u  g6 v( g4 |
//速度(1-10); a7 L1 h4 q4 t4 u$ Q) W
var marqueespeed=3" l; {  Q; t" ?5 n$ b
//背景颜色
% e, N8 S8 o, _, U9 ~  Svar marqueebgcolor="#FFFFFF"$ h0 @( J0 w; p4 C
//是否能暂停 (0=no. 1=yes)?+ g; E# Z" m- j7 Z
var pauseit=1
3 y' Z% W7 a! I3 z" P: F6 E, d# a; B0 ?3 _3 l: W6 k; J
//修改显示内容
# a5 m# o7 N; R& pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
- q4 {4 g7 [$ a, q# P7 j* \1 k. G7 k4 {& [. q6 c" e' p
2 D% n/ B, i6 U% D$ y
////下面不需改变////////////
; I" @2 w; K6 Y7 _6 _4 P- \: O
' E: z0 ~% S) q6 @, V# V+ l0 ~2 Lvar copyspeed=marqueespeed
1 {7 p8 Y$ R' ~$ [) ovar pausespeed=(pauseit==0)? copyspeed: 0
7 N% v% o0 Z- j. ^4 Svar iedom=document.all||document.getElementById
* r; n- B  ~, J; ^' }if (iedom)( ^7 U& {. N7 ~8 C
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, J; v8 P5 D% ~2 i2 i& m5 }var actualwidth=''; @" g1 v8 Z1 H  D- Q' q0 C
var cross_marquee, ns_marquee
& d* T+ C) z3 \% z, n1 U# G% N
! C4 p: U5 n. B1 Jfunction populate(){7 A. l/ T. z; \" p2 e$ {- y" e5 S1 p
if (iedom){
9 g. F( k& E6 s9 y, W6 lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, z; d: F( k5 Y: l2 O
cross_marquee.style.left=marqueewidth+8
( `$ h) U/ G( {; S0 C+ Ycross_marquee.innerHTML=marqueecontent
& u  w* q9 h* _& ~0 d6 O) m, i. Nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# x2 p# X8 ?! c, p" u9 S8 Z7 v}
8 \1 J( F/ R  e; M# |else if (document.layers){
' E7 S+ w7 t3 y+ Sns_marquee=document.ns_marquee.document.ns_marquee24 A' b) Z5 Z1 O) E( j/ ~* w+ K# ]
ns_marquee.left=marqueewidth+8
. K0 ^# X# t' e( V5 |; Mns_marquee.document.write(marqueecontent)
5 c  ~* m9 T) P- f; z$ s% z# cns_marquee.document.close()
% H) s. F% O4 y7 ]actualwidth=ns_marquee.document.width
/ ]4 @+ \$ _& ]}) W' x0 O$ b7 C. Q9 P2 T, S* x" O  p
lefttime=setInterval("scrollmarquee()",20)
5 u( q$ R, m: p* k2 f$ k9 P9 c}
. a& y, T+ O; J  e: F) fwindow.onload=populate
6 V% {% m" N2 j- H# ]: [& _$ r6 ~0 X1 I) A" S: a5 M% C
function scrollmarquee(){) @& X( u! y' c6 n  s( {
if (iedom){" ?% Y5 T" r3 S3 V
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! F6 ]9 M1 M% ~# K/ o6 j6 qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; e5 U2 m/ @) jelse
8 S- U4 ~, S' h0 pcross_marquee.style.left=marqueewidth+87 X- f* x' Z4 G+ U/ _
& H7 e  l' |  p' ~8 f
}% V' B0 i$ T' n$ }  j; c
else if (document.layers){
' Q# e8 j6 }- t7 \4 Kif (ns_marquee.left>(actualwidth*(-1)+8))% J2 `4 t( `9 [" H) P
ns_marquee.left-=copyspeed* r6 Y. C9 m/ n: ~1 w. O
else
4 h: Q+ z# r/ J% bns_marquee.left=marqueewidth+8
$ d( r. f2 L. I$ v* M6 F- \}
2 O& G  d" g6 [" g8 j* O}
9 m# J  c. n+ ^9 Z# L' m. ^" X& L8 V$ I- i' T8 i
if (iedom||document.layers){
% q. l# F/ L6 \  [2 |) \& @9 O, \) Jwith (document){1 w- e3 U5 A) q* d& Z* U+ x4 f
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). e$ S0 r7 a( R3 ]
if (iedom){
: O0 K+ A" f9 Lwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- V( T; U% I. @( s7 B! C4 N  A$ Twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 T7 O) E0 ~$ i7 [7 H
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% M% p/ R, x% m9 i7 L8 i
write('</div>')2 L$ i8 i6 i7 U& y% y
}
9 F9 x2 Z6 F+ a% E( x) Helse if (document.layers){
) B$ ~7 V  r3 @write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. _. p) I, U( M- k6 Owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 h/ A' o9 Q, i9 M" p
write('</ilayer>')$ u9 |4 I5 {* C( C% N& Y6 E
}, [8 C9 I  p8 F1 g  Y! G
document.write('</td></table>')
, E1 F  _; X: p/ r4 _  ^4 B. f. S}$ p0 \1 N. P9 I5 c: ?- X1 w
}
" g* \' I; p5 [/ X* X</script>

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