返回列表 发帖

网页之跑马灯文字特效

//修改宽度
- \( ?% ?+ |0 f  _  L( h" k4 svar marqueewidth=300
' ?$ a9 P. O' q! _: R8 I//高度
2 f; a3 F$ d8 W2 v9 zvar marqueeheight=25
% p, g! f! ?1 J0 w//速度(1-10)( o  S- ^- G' S- w1 O6 z; I$ U
var marqueespeed=3; Z2 V2 R$ w+ p
//背景颜色' j0 p3 G, _0 i; U! t
var marqueebgcolor="#FFFFFF"+ u) m/ ~% _+ I/ l, Q% s) n, T" E
//是否能暂停 (0=no. 1=yes)?
! T% _7 v2 U4 b& {8 a! h2 W" `var pauseit=16 s: K! P. t* S# |3 b: }( @+ v* v
1 q4 y) K, J# P
//修改显示内容: U+ t+ i2 V. x: ]
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
4 J& m/ b$ Q6 A, ~* a
; \2 \4 U( F! I* }. e8 E0 o  _9 t; N2 U; R# \! |6 C4 X, N) N2 J7 ^
////下面不需改变////////////" H, N, @6 F% o0 q! d' _: P3 s

2 Z  p! G2 n! n. E# @/ G, ?var copyspeed=marqueespeed
- v4 x2 c0 d( B- ]! k& S# ]var pausespeed=(pauseit==0)? copyspeed: 0; D. Y" U( a' s4 N  k8 H, D
var iedom=document.all||document.getElementById
+ n) V" G% Z. }if (iedom)
$ T8 u/ e) D( m) e) ~/ U0 Ydocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. D! J$ N2 h3 N/ }) Vvar actualwidth=''
% p5 }& {) Q4 m  o2 Avar cross_marquee, ns_marquee7 j- n0 N6 j- T* [& G

& H" |+ Q+ T' m/ bfunction populate(){! h& ]2 e! G9 z+ ?6 C' y
if (iedom){
: `' J) u( V8 L" }! ~: e5 Fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 o4 u& W6 C" C; B4 x3 j
cross_marquee.style.left=marqueewidth+8  J" h8 I/ A4 w  _+ R7 v1 {
cross_marquee.innerHTML=marqueecontent
  t- p+ Z3 P& C" Z, Z2 \; Eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- K0 o- \, x+ ?8 k}$ J. ^% x% i  x6 u
else if (document.layers){: J4 ?2 F. @- a+ w& V; {
ns_marquee=document.ns_marquee.document.ns_marquee2
6 j  N! X8 H8 l3 ^% W# ?ns_marquee.left=marqueewidth+8" w2 k8 q( N3 F& v6 c. ?# G
ns_marquee.document.write(marqueecontent)/ U- _' ^* [( @3 Q, @
ns_marquee.document.close()  `* I3 _; f% v% M7 `9 a. ]# }
actualwidth=ns_marquee.document.width
+ f8 P4 `8 Y; @9 |3 z}
7 K" n; |. D" p! p, @) alefttime=setInterval("scrollmarquee()",20)% J( v: P0 g4 ]( K- X
}
3 M9 q$ o  p  x8 ~window.onload=populate( p* D6 |( z) c; R
2 H+ U* V; H( T, }/ F: _1 N
function scrollmarquee(){# c4 l9 `' A# d6 s3 ?/ s; r
if (iedom){4 i+ }! @- \1 c0 L
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), m! j$ B' W) U6 t* g) M5 J
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' R+ m: `6 B# ~6 S$ O9 T- d
else
$ }+ Y8 V: u& U4 @. Y* E( Wcross_marquee.style.left=marqueewidth+8- W. H7 s$ f8 u6 J6 O. C5 |+ j8 t

% N8 n1 L+ g+ S7 n$ l# {}
1 X0 @) }& n" H' Melse if (document.layers){% x9 k* E1 X# v. T
if (ns_marquee.left>(actualwidth*(-1)+8))- N+ ]8 Q/ `5 o, V& @
ns_marquee.left-=copyspeed3 @5 V. w6 e( N& K8 r
else! W, e( R6 l, g2 I" {# X
ns_marquee.left=marqueewidth+8
* f( M; o0 A4 w}! V. i+ V% }2 U, `! N9 n
}3 ]9 g+ k. e, l0 T# n. i

) K8 m4 `+ W) B. [: bif (iedom||document.layers){7 k( T" Z! y" L) J
with (document){
( r( I" L  [* _document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- V5 j% e- J8 W' A# A& ~3 Lif (iedom){
3 I+ ^8 u' d2 D0 k3 |write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')/ a/ B  N; f8 T+ ~5 R! d/ h$ B# O
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& C6 X+ h" ^+ o! Cwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" w7 K! i: v. f, W7 _3 |write('</div>')  G5 x1 L% {, ?8 t$ g
}: @# J& A5 j# o! M* I
else if (document.layers){" |8 E* g& ?5 q. L- f
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), B4 u' |: d# }/ d
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). c- C6 ?; G$ I' V% c* ^1 W
write('</ilayer>')6 q* S7 W$ S4 V; g8 d1 B
}# u  M# L: H" I. I! {
document.write('</td></table>')
2 c/ _* e2 \2 l; {  ]/ g1 B1 D}
3 I' b7 h% \- Y4 v3 s5 t}
# v6 F9 T$ Z8 ^7 q1 y' y$ u5 Y& H</script>

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