返回列表 发帖

网页之跑马灯文字特效

//修改宽度
2 {: U, y2 i$ k5 g- ovar marqueewidth=300
+ s* p4 U, q" @; ?- i//高度7 k% w# m7 R) g( _& y# `" V2 N8 ?
var marqueeheight=252 P* i( N& s4 l4 {% S% S0 F
//速度(1-10)- F8 ?7 \" ^: z$ w5 Z
var marqueespeed=3
9 u3 R9 z9 j4 k//背景颜色6 n, J# A; A/ f5 L, T2 u
var marqueebgcolor="#FFFFFF"
4 g. j  s1 {# [$ ]9 @0 z//是否能暂停 (0=no. 1=yes)?
$ N+ p2 A7 g9 C; N4 L+ A+ P- m; Ovar pauseit=1
/ a1 o( G5 ]" C
( ?; z! D% ]; t2 C$ ~//修改显示内容8 @* f' \- ]3 k2 F1 u' b
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 f- b$ @4 c. v" A; A' A8 d7 R! f, I
( h6 o2 q+ f: x7 j
////下面不需改变////////////3 ]1 W" V, k1 ~% Y. Y( o

3 ^! r! r8 V& ~+ l; vvar copyspeed=marqueespeed
" d6 E5 l) W" U6 j) ovar pausespeed=(pauseit==0)? copyspeed: 0
0 o+ x* |+ P7 q- I, _* X' p8 |! Yvar iedom=document.all||document.getElementById" A2 x6 j: b4 D" q
if (iedom)! j; B; f7 d+ d
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ f3 d6 b. W$ \3 P- `
var actualwidth=''- ~! [7 A( d0 F" v! z. A
var cross_marquee, ns_marquee
/ c; F1 H1 B7 T, I: e
! R: C6 M% E) |: U0 v/ r, Vfunction populate(){' C/ X$ _! V* n/ U5 N9 A2 S8 M
if (iedom){6 n$ _/ N$ B! A+ t1 t3 g& N
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% v' h+ w4 E1 Z! a0 i" Q
cross_marquee.style.left=marqueewidth+8
$ F4 ^, o* x1 a+ ^7 Zcross_marquee.innerHTML=marqueecontent
+ T2 R2 ~6 G% L9 k( P' g0 Dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" y/ i: S+ r+ o* _
}
# c- G9 P- A! [else if (document.layers){
) M% e8 L* I  e! u) {; g) I1 mns_marquee=document.ns_marquee.document.ns_marquee2
& Q3 w# K. F9 ]7 A' \- \ns_marquee.left=marqueewidth+8
# \% {% K; s' B, `ns_marquee.document.write(marqueecontent)
, \& N( u1 b9 uns_marquee.document.close()# h, V, ~. Q6 b. ~( p. ?
actualwidth=ns_marquee.document.width
$ H& t" S* A. @/ q- M}
# S( A8 r5 p* Jlefttime=setInterval("scrollmarquee()",20)/ s6 T" [) q+ Q# p
}
2 L1 A1 d( T7 X$ G4 h* owindow.onload=populate
0 e) {; Y9 I' y" q/ o, G- a- n
  m5 v. _6 C+ hfunction scrollmarquee(){
7 g4 P. s. l7 f* b* ?1 ?, yif (iedom){
; M0 h( u! N6 D& X8 i6 yif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 }1 E! K/ Y# W5 |1 Y1 l- Scross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed0 R9 H& a0 M/ J. a* }( }( F. U
else
, ?) H0 }# ~3 Q/ y; H+ \cross_marquee.style.left=marqueewidth+8
4 a, v4 Z3 e/ p
$ l, M: _+ y. P& q. @4 a& p}
6 }0 |4 Z7 E( r9 I$ H  gelse if (document.layers){
! U0 O! S& s3 i- ~if (ns_marquee.left>(actualwidth*(-1)+8))
1 Y  y, V4 [* _& Jns_marquee.left-=copyspeed
1 R# t) H+ u" e" k# u9 T+ `. r1 belse
! A5 A7 i) B: ^/ P4 ~: N) @ns_marquee.left=marqueewidth+8% K- h1 G& ?  h* v
}, l* i3 M6 P3 @0 X% m
}
! |* ~' o9 t: D
$ C' T, C1 ]. A$ T0 t  r( Kif (iedom||document.layers){
7 s6 q* A& G, L) q6 swith (document){
; g/ \) j# v& h5 @1 idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); t% W0 u" k+ }1 \
if (iedom){* {4 _* ^7 G2 N7 \$ d( m, Q
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ a; B' H7 p4 Nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ ]2 X- J! o/ H- {2 Wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
( S: S9 M& m7 Wwrite('</div>'); M& k+ t4 I) I& \# o; d; R
}) T: B! g7 r( p- g* w4 ?0 s+ z, ?
else if (document.layers){
3 b* p2 Y( x- p1 D$ B. ewrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')9 _. Z0 B6 B- W2 h, L# }7 V- n
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! B& S( H! F- u2 E2 Y- \write('</ilayer>')
( r! I+ }  ^9 W1 n" P. N" u}
  ]$ A0 G; G4 C1 Q2 o' k' T  u0 ]document.write('</td></table>')3 @6 n3 T, Y" ]9 X: X4 \
}6 O/ e2 u* x* D7 t) a
}1 ^* ^) W- q% [* j
</script>

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