返回列表 发帖

网页之跑马灯文字特效

//修改宽度
' I$ z( ^1 l/ T9 c9 s3 x- Hvar marqueewidth=300
+ u* f# v( p' V$ H5 O! J//高度
4 Q8 g" Y! \4 E% F1 c2 Y2 kvar marqueeheight=25
1 i- Q- }" y" e/ C" H5 e0 B//速度(1-10), G, C8 z. b. o/ e$ d. W% m
var marqueespeed=3
: I1 \0 p% Q( \+ j//背景颜色) ~& {8 ~9 U/ ~7 @7 Y; ~
var marqueebgcolor="#FFFFFF"% u% I9 [% h. v% j
//是否能暂停 (0=no. 1=yes)?: s; T/ N' }* m2 q3 p% P$ C, p% ?
var pauseit=1
" z- E: D- ^7 D9 m2 ^! V' c7 p: h
: `$ u) n( g/ t# p! [2 Y//修改显示内容! R; r1 }5 g! r" S& Q
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>', F1 d2 N5 B$ N( w2 ~% k
/ t( a7 `0 N- X' p
  P: e* f# [, O" U8 Y# C$ L  K$ x
////下面不需改变////////////
# Y5 D! X: Q0 q% S* c, T. O. ]& J. V; R6 V. ^, Z% s
var copyspeed=marqueespeed
0 w$ Z" w) S! u5 A6 z  Svar pausespeed=(pauseit==0)? copyspeed: 0: ^& p- z$ q) Z2 l7 M
var iedom=document.all||document.getElementById& t6 L; `& W) z+ N8 |& i8 F
if (iedom)2 J( z/ y( G, V9 D) N* q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* ]8 F( Y- E, o" U1 O
var actualwidth=''
2 \% \) P* U* Y. a9 k) qvar cross_marquee, ns_marquee$ f3 b0 o4 V4 ^$ N# O: N( u
4 V) a/ r2 o0 I9 f3 `3 e$ s& z  U
function populate(){# Z3 B5 Q8 |' @% |. k$ q) A
if (iedom){
6 k  J7 T8 S& N) p3 jcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' h. u( }2 k8 O$ B/ N
cross_marquee.style.left=marqueewidth+8! g" m4 z' o6 |1 X' K3 T
cross_marquee.innerHTML=marqueecontent( i# _+ E2 k( ^6 i' Q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# ?1 ^% @- n% o5 u& v1 p0 W9 q}4 N& v6 c) E* i8 q& `4 u+ Z
else if (document.layers){
  j" c  ^7 S0 O' vns_marquee=document.ns_marquee.document.ns_marquee2
) ?1 n( B1 N, Ens_marquee.left=marqueewidth+8. F+ p9 K% I% r) d' D* n! F2 T
ns_marquee.document.write(marqueecontent)
! K' S0 Z% g1 [ns_marquee.document.close()- h& J+ N5 x7 a9 v
actualwidth=ns_marquee.document.width
) [, I0 v$ q7 I2 I6 r  K}
7 O: X/ m$ c5 |  p7 Klefttime=setInterval("scrollmarquee()",20)
- A- @9 b9 z; u% M/ e}
/ I4 N$ M: S" Z( Cwindow.onload=populate/ G2 s7 w4 I- C1 L+ D# O! N/ U* h5 n

& P: U2 Q( L4 _: s/ A% |function scrollmarquee(){& K/ o( f9 P* S4 `0 Y8 H
if (iedom){
( V- n* ^4 p$ a2 x; ]% [if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
+ `5 `8 [; |& U- z/ K2 ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 H8 v* X7 q7 x" ~/ {& R0 nelse
6 K8 n7 M; ^: _4 P: E/ tcross_marquee.style.left=marqueewidth+8
1 }9 C1 B# e: N/ H% p$ ]" x- ?: y: b  H  `6 Q! p9 j
}* J# }5 e/ C5 v  o
else if (document.layers){" ~0 u" @% n% X2 r2 q# k- ]& l$ w
if (ns_marquee.left>(actualwidth*(-1)+8))
6 {9 p, n+ h6 B& k& ?$ m( Jns_marquee.left-=copyspeed
8 Z+ F. |3 X4 |; l9 M! H. r" k3 Y. ^else- G  l  w1 W- ]  j  n
ns_marquee.left=marqueewidth+8
/ M' s2 p" `6 @; \0 ?5 C' V- r; U}
+ R# {/ Z. A- a}3 ?1 Q7 H1 i0 I
& ~. p; J3 X2 k
if (iedom||document.layers){
7 k3 ]$ m/ N. x8 m: B' N9 Awith (document){
! T/ L% `2 O! Z$ tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 w! \( Y$ J# p7 R" m2 {if (iedom){1 t$ z( G# X( J% q
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& ?" q( U: Y* `, U/ j8 T1 P3 Nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 M/ o0 X  o* l5 M% y: g) L( w7 O+ y6 e
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
7 J2 |2 e5 K1 I* Qwrite('</div>')! B: w4 w9 v* i4 r" J3 k
}
2 A! P4 L, `* H3 Eelse if (document.layers){
. V" G4 R6 B3 Z9 kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 n9 ]* i  K/ \3 R' U0 Pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')+ A5 J/ ?/ F( {2 o3 e
write('</ilayer>')
1 D6 E$ ~" X& X" q) [5 O* c}' ]5 T1 `: H/ R/ q% I: `# r
document.write('</td></table>')( [. R8 B8 {' P2 Q1 k
}
# v( X0 `9 X& U0 m) Z! l}
/ N' R% I' \$ W3 X  L1 n  w2 m</script>

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