返回列表 发帖

网页之跑马灯文字特效

//修改宽度
, p* K& P2 d- P& x3 Xvar marqueewidth=300; B1 t# p: Z* X7 {; o/ M+ j
//高度
' k4 f3 m& k8 d7 Q  m$ u( jvar marqueeheight=25
! n/ E$ g& X0 J* i7 F/ J//速度(1-10)+ b8 d; t* f* d; x0 n
var marqueespeed=3
/ D- N4 \- n0 {7 k//背景颜色/ J' N8 L" X) A% t8 C# o
var marqueebgcolor="#FFFFFF"6 m( k' _( l3 |" ~9 g" O
//是否能暂停 (0=no. 1=yes)?
( M# c% h6 b: T& K, ^2 c$ h" xvar pauseit=1  @+ y) _: g3 ?- n8 d

) Z" B) ~3 q+ N& G//修改显示内容
, a/ z! Q9 U+ M# _var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. @) w$ _6 ]# m8 W' H4 o: _0 a4 K( t2 Q: S# S
8 v) n. r2 M& i9 L
////下面不需改变////////////
4 f, H6 U/ D2 w, ?& B" u+ m2 D
var copyspeed=marqueespeed
2 |  k2 H6 U2 Z1 bvar pausespeed=(pauseit==0)? copyspeed: 03 T! I* H) Q1 o* l" y2 f7 b6 j
var iedom=document.all||document.getElementById
0 b/ [4 A1 H  Z, t! Q* _if (iedom)
- _6 n2 k/ c/ [- p) m& G2 bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')# q: F, h4 H& g0 q2 b3 f6 Q* S! ?
var actualwidth=''
4 h1 ~3 G/ ?' O: i% B1 q* F, n( Yvar cross_marquee, ns_marquee% v0 d3 p& n6 m  z2 O

* o# d7 c0 K* h2 O) s1 W7 ifunction populate(){
% z! T# ^, P# e/ \: Oif (iedom){3 u4 a' `& t$ K" l! w3 M
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, w; I0 s" C; m& s" [2 b8 t) m
cross_marquee.style.left=marqueewidth+8
2 G6 k7 O6 D( L) N! ~cross_marquee.innerHTML=marqueecontent
# K" s  W$ n4 D: I" @3 _actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
  z! _6 A3 V  E- H2 j# \, n& f}. A' @' f: _4 d
else if (document.layers){! O# u0 k+ G; @' X
ns_marquee=document.ns_marquee.document.ns_marquee2
3 ?0 }3 e8 {; F5 V2 xns_marquee.left=marqueewidth+84 u7 ]  ~  w- w3 Y8 a. b
ns_marquee.document.write(marqueecontent)- M: h4 x9 i- F( v9 R4 r3 H+ G
ns_marquee.document.close()
2 w8 y/ ^  V/ x5 C; Sactualwidth=ns_marquee.document.width6 d. _6 X9 j  \1 ~3 Q9 `# }  v
}
7 }' e. z5 b+ u2 x+ [lefttime=setInterval("scrollmarquee()",20)
( i' S+ P0 Q  h, _- Y8 h}
7 l; U9 I" v' n- f0 a8 b  L5 ^window.onload=populate- B9 ?: u2 o6 E( [$ p. n. Q' m

9 E4 p0 N; S+ W9 v  ]; D" c3 n1 i2 W* ^" kfunction scrollmarquee(){
1 x! F+ N# ^' x& Q9 i# F" Y2 t0 Pif (iedom){
2 F) W' i# p' `if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
+ i8 ~  ]' U: [, h. U# \cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 k6 L3 j. U8 r% h4 q2 f& _
else( o5 c# J2 ]3 v: W/ R. m* x' \
cross_marquee.style.left=marqueewidth+8
/ V, b$ R$ ~& d" _
6 i0 @7 A/ h+ b}
; h2 M* p8 G* r4 Kelse if (document.layers){: K# }8 Z: J& i- b9 }
if (ns_marquee.left>(actualwidth*(-1)+8))
, z0 B4 V! P; I' D& U+ Xns_marquee.left-=copyspeed
5 m3 J# D1 o- e6 O' D/ ^else& P/ T, P0 B+ o6 \# Q
ns_marquee.left=marqueewidth+88 i2 G, {: ~/ q  u7 O! B
}, i2 w) D& c6 w- w
}
* U0 ^0 v1 Z3 l' R3 Y; j* j2 m
: t  d0 D" k2 Y) t9 n8 Mif (iedom||document.layers){" f) I. r# @; i9 z7 \
with (document){3 }; T1 N8 r6 Q$ @' G' T7 X/ ]$ V
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')  k1 j2 y% q/ [1 O, V' Y" R
if (iedom){
% p# ?( u$ V+ T1 c: Awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 I: L9 Y2 U% i" [* b: ^write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); P7 Z0 y. N, v8 l
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" q6 {5 F6 S+ M5 }: B- xwrite('</div>'): \0 y4 l0 n: g5 R
}- \8 R* @5 t7 `; D2 Q! t; ~: Z- E
else if (document.layers){% u- ^' M4 }8 @& d3 N  r5 L
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 @3 k- y  X+ X) @/ |0 h0 W. d: t
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" F) K; {! k& y5 L3 w1 U, j) P
write('</ilayer>')
9 O/ N- o- i* g5 \+ A$ a% t1 B}3 Z& X' @6 v; V8 S: G
document.write('</td></table>')
; r) W0 ?" d2 V- l  ?7 R}; q% Z- Q' l, v8 l3 L8 o* X  Y' x
}8 i- v! }( @% q
</script>

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