返回列表 发帖

网页之跑马灯文字特效

//修改宽度
0 f0 p! v$ C2 Y. S3 j; u/ E  N+ Uvar marqueewidth=3006 t; Z0 V* ~& H# q
//高度
. q- N7 b5 L% a) D" j. x; ~2 A8 {var marqueeheight=251 @, ]* H0 s$ Q2 {# k6 x9 F  B
//速度(1-10)
" S" @! I# B- O+ t8 h+ a% O5 L: vvar marqueespeed=3
1 a. ]# n7 d6 o, q) C//背景颜色: Y( [: H4 p/ |
var marqueebgcolor="#FFFFFF"
& p: x$ m' `+ J" n, Q! s//是否能暂停 (0=no. 1=yes)?
( |8 C& d/ o. B% ~+ q4 P! ?var pauseit=1
! I. X' `/ Z1 X8 t. G' e! B$ f5 h3 l
//修改显示内容
7 q+ h) W1 S5 i( @7 P  pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. {8 @/ l" j- ^
) V" \' ^" l* Y" t# @  g8 e$ q0 l5 \* H8 p5 h: x& Y
////下面不需改变////////////1 Y0 d- q3 u" {4 a

& Q- i) q1 e6 O, q/ d5 ?9 Y! O& \var copyspeed=marqueespeed
7 K. y+ J. J- B5 @; Tvar pausespeed=(pauseit==0)? copyspeed: 0* t0 ]; s6 y" |( C! O" Y2 Y
var iedom=document.all||document.getElementById
. T7 d* A4 s2 I' A/ z* |. s% {if (iedom)3 b: @: V% t# R4 u/ I, ]( t- P3 g
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& D# T% S6 z' Lvar actualwidth=''
2 }, c: |. j+ S2 L6 zvar cross_marquee, ns_marquee
: ~# g( w6 y- @% U, J5 m
! N9 C" X: M# {+ H' d: Zfunction populate(){
/ _* o2 @2 {4 ~; N9 [if (iedom){( e! I5 G7 Z. Z  {9 K
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- F3 p9 `! k: S! J* n
cross_marquee.style.left=marqueewidth+8/ X8 M2 y& H! q
cross_marquee.innerHTML=marqueecontent
) ?. Q; I( y& X8 d- Mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 a5 T1 D% v* G* F' v}: P! c. W) |: L+ B
else if (document.layers){) ^2 ]3 v/ Q7 r' p% I$ o/ Q
ns_marquee=document.ns_marquee.document.ns_marquee2
0 n& d% h' o( R. ~ns_marquee.left=marqueewidth+80 ?& B9 M: N. x; f5 W% k
ns_marquee.document.write(marqueecontent)) e% Z, u+ Z/ q4 [. n6 o3 k
ns_marquee.document.close()
& q+ @" `4 D+ q! `+ o" C( Cactualwidth=ns_marquee.document.width0 ~8 n6 d- x- B1 k, Z; s
}: u8 f' u: @5 X$ P2 W
lefttime=setInterval("scrollmarquee()",20)# @* g% {" H7 W7 {4 K
}. K* e- h% I; g- V
window.onload=populate, t# M( T2 _. @, d' G7 G
# H: p' P; M5 X  F( N
function scrollmarquee(){3 j# d( F7 m+ a8 F% U
if (iedom){" z2 R& K( e( a' h8 S" l
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))  L' ]3 E6 \8 a. K
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 M/ Y# w" V: ielse
) i7 F6 `0 t  j0 c- ?. ^cross_marquee.style.left=marqueewidth+8+ X: H! R5 d8 w6 j

4 u1 O6 G% g0 ^' W- c}6 T8 M" Z8 x* |7 I
else if (document.layers){' U8 O7 l' R7 Q7 }. R5 N3 p3 L
if (ns_marquee.left>(actualwidth*(-1)+8))
" L  y4 p3 _" l# L( j4 Sns_marquee.left-=copyspeed
0 I# Y4 w/ J/ k" h' E: ~else
5 x7 b( ]( X2 e5 o- gns_marquee.left=marqueewidth+8
, c2 b" K3 M# q}# C# Q. S! O. b! [& Q* f/ d! H4 S, U
}
" D/ S8 x4 ]5 n2 r7 _) j7 G
' Y+ J% B8 N& z. l8 Dif (iedom||document.layers){3 M! m! y) {0 ?9 Z2 K
with (document){. D- |* T( ~# K  C
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" Z/ J! e: p3 i9 o/ R* Bif (iedom){! K9 f5 o# c7 _5 x; a! G
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' m6 D: H2 [$ Q( [' Dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- x( ], B' b8 Q$ mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ Q  u$ L; l3 W+ w% s0 L
write('</div>')
# Q4 C. T, u& E! v; f. B" J}' o9 U/ k8 D# V' O; d) X' n/ K( w
else if (document.layers){# }& q: X8 P- r+ g$ u
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( R( j# H) Q  [2 ?
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 ^' `: j: V1 `- I) o
write('</ilayer>')7 l! L  `1 K5 |0 p
}
' h4 m% |. I0 O! cdocument.write('</td></table>')
2 g6 d/ F! v! q; I+ s. B1 F}- ~' u7 T6 s! B- W( ^# {3 j
}. F3 w% I  ~- g+ D( ^( c4 e; W. C
</script>

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