返回列表 发帖

网页之跑马灯文字特效

//修改宽度
8 T  @* A1 j8 m; q' X4 @; z  ?var marqueewidth=300( n" O  ?" [5 u5 x6 V
//高度" m  \* D) J) T  ?! X+ X
var marqueeheight=25" ]" S' Z- Y/ q
//速度(1-10)9 B. M( K6 l/ U$ F6 L3 ^
var marqueespeed=3" l' z6 ]# g8 g, r! c. r% w* o# A
//背景颜色" B5 ]* Q; s" M  O
var marqueebgcolor="#FFFFFF"
1 q& f* J( P8 |; j: ^//是否能暂停 (0=no. 1=yes)?0 l- Q- X; ]0 |. v8 W  b5 K% J6 q! _
var pauseit=1; b* D: T) P& b; B; }9 r6 C' f

& L" k$ ]) v1 y5 V+ L9 G//修改显示内容) p& R5 c0 e" N) t2 P  A& t+ R2 E0 V
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 m7 N! b% k# P
9 X/ m/ C. Y: l
  M* r$ R0 {, Y4 n% x  b1 [% j
////下面不需改变////////////8 R) e7 r; M+ r# e
: ^( i/ A5 x$ `1 B" b
var copyspeed=marqueespeed
" z8 ?0 W( A$ B; K# Ivar pausespeed=(pauseit==0)? copyspeed: 0
; P. G7 M* h* ^8 Z1 {7 [9 Dvar iedom=document.all||document.getElementById2 c2 u0 }* p5 Q- Y+ L6 o
if (iedom)
$ ~1 \6 d7 D& B5 W1 V' `' N6 ]4 bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ c* f! R  T( z) F$ hvar actualwidth=''
1 Y1 n" A5 E5 _- W2 \2 Cvar cross_marquee, ns_marquee( s( [# r( }/ A

, P5 W  \$ ?. tfunction populate(){. `6 T, m  x$ D# x' ]
if (iedom){3 ^  ~; `3 n5 ?  e
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
  C7 L( z9 E5 Z& l) ?: f% ]cross_marquee.style.left=marqueewidth+8
" v7 X5 O" ]! ^6 z) _3 `. L9 O; n, @1 hcross_marquee.innerHTML=marqueecontent
" n1 o6 }  C* jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 e) A+ h2 a- p  z6 U" R1 ]
}
) X) c8 n  g4 e! L/ H6 Yelse if (document.layers){
$ k: M, O. {* o: `ns_marquee=document.ns_marquee.document.ns_marquee2
' [" S3 V2 `& a/ k% t7 W6 C" Dns_marquee.left=marqueewidth+85 C& G- J; c+ |2 K+ W0 Z* ^7 Z# \
ns_marquee.document.write(marqueecontent)
) c+ i: |& V2 J; o! b/ }ns_marquee.document.close()
, l: v9 j0 ?/ I  G$ ractualwidth=ns_marquee.document.width( u0 y: \. W' w2 g; o. a7 ~/ d8 W/ P
}
7 X$ o' r: `) I2 Blefttime=setInterval("scrollmarquee()",20)' O' @* G/ q, o+ _1 _
}+ G% z2 R. o% u0 v- M' @4 u+ z
window.onload=populate
$ L% g0 Z1 F" S7 r5 i
) P% E& |' v. u, Q* Kfunction scrollmarquee(){
; W' |7 L) {; r4 d7 Sif (iedom){: O* c: V! k! y8 E8 ^& r* {5 O
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* C% W* `; A2 T# N  h4 e% K; Q
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' l6 o1 e6 g4 E$ y  |
else
. Z+ S/ D8 e/ jcross_marquee.style.left=marqueewidth+8
, ]% k+ x' x+ d, O* K% V
7 j9 `1 t+ A* H& n# k}. A7 b3 r6 Q& [9 F, z$ T) j
else if (document.layers){
; z0 z+ N0 t/ b0 o) s+ N( ^; pif (ns_marquee.left>(actualwidth*(-1)+8))* u( p7 X0 B# c7 i6 u0 |2 I2 H
ns_marquee.left-=copyspeed
, k. }8 Y9 k' l5 o5 Gelse2 m# ~" t8 A+ M7 q: A$ Q) b& U
ns_marquee.left=marqueewidth+8
3 E' C. I: k. Y+ l9 O$ U" {}
# i# g5 Y7 j5 Q0 A}- ]. }/ @+ i2 _: r$ a' o
5 f6 \- j# a7 f
if (iedom||document.layers){
( m- \2 v% C& x& ewith (document){6 i4 A2 h( q. j
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# |3 K, T% v( H4 q
if (iedom){
/ T, j$ I& L# b# J, n1 f& E5 Z  jwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) f. v/ p* e9 g* T( L  |& d4 Vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 I4 i3 f5 T5 k  @5 o5 Dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
# d+ N& `8 n8 I# X3 o3 ]& Rwrite('</div>')
9 e8 e0 w  K2 s8 Y! x}( [, W( p2 _6 F7 w! Y* k
else if (document.layers){
! K! T# s: j8 ?& Kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) s: H+ n, O( A  o; t2 Vwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 I  {# K7 l0 G8 S, d# p% w
write('</ilayer>')
8 w; U4 }( A  f}1 F3 `+ S: s  I& Z
document.write('</td></table>')1 X# L! ?4 u) r* t# Q
}
: K2 G/ t3 \5 {; N3 }- ]# a}
1 e; F5 t. T& L</script>

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