返回列表 发帖

网页之跑马灯文字特效

//修改宽度  W5 t: g, Y7 H, H9 @$ b" n' b, p
var marqueewidth=300
! G! C! w* W' i, u. G( i3 Y) X//高度
$ ~9 f8 |# r9 J. ~var marqueeheight=25' j. `$ d$ v  G8 b( A; `
//速度(1-10)
2 @6 J# }( ^" m6 W+ fvar marqueespeed=3
$ ?# i. B1 s. P7 A9 m8 g//背景颜色1 {: s: H( @+ w* ?% R, x& Z
var marqueebgcolor="#FFFFFF"
; }8 D0 D  p" ], K7 Y" V" c' ?//是否能暂停 (0=no. 1=yes)?
6 B6 B3 ^1 s( S) t" K- O* Y( avar pauseit=1  @+ \; i* J: J, n
/ K  {5 {2 ]8 g* i, N% u/ P* ]
//修改显示内容- U7 ]% d8 w7 f2 l  c
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 T' Z% l8 y! k& t, k
5 [# |, u$ b$ `  X% ]
! [) Y- m; F1 T* y( L, v- \////下面不需改变////////////1 H& j2 ?  r0 U+ Y) c9 B

$ L! ^& s* K$ I" W) Wvar copyspeed=marqueespeed. @, e2 h& J" c2 D5 ]
var pausespeed=(pauseit==0)? copyspeed: 0! K5 _5 |; ]+ O3 `0 A- b
var iedom=document.all||document.getElementById
& m8 C# _# Q! Rif (iedom)
/ l3 p8 Q- u- m. Q2 \document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ G$ o$ C* U) C6 bvar actualwidth=''9 T! O. u) l" `2 `) v2 {
var cross_marquee, ns_marquee. Y5 Y% p" y) w+ o4 ~/ d2 ^

2 j# S% E( l/ c1 E9 O% cfunction populate(){* k9 l, p1 ]1 X+ H
if (iedom){
( I3 E9 ?6 U3 E- l& gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ J# m7 z/ u2 y# m5 dcross_marquee.style.left=marqueewidth+8
) u. h( w% p: |4 s8 T* Ucross_marquee.innerHTML=marqueecontent( t  G) `; i2 l  U
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ Q. T! n: w' L4 d}5 K  l. ]7 n; N; E; n
else if (document.layers){
5 D* O5 q( Q! mns_marquee=document.ns_marquee.document.ns_marquee2/ S9 M; \- K0 v( c7 ?. O9 r( {
ns_marquee.left=marqueewidth+8
, w  _9 {9 t( p) ans_marquee.document.write(marqueecontent)7 {8 J1 }  A0 c7 O; c; v
ns_marquee.document.close()
3 H7 {; k5 Z, [8 Ractualwidth=ns_marquee.document.width4 V/ ~0 O) _- L$ M
}: e! D: T# R0 F- x4 {$ y
lefttime=setInterval("scrollmarquee()",20)# c) L7 a6 W9 D. W: I" y6 X
}, u3 h9 ]8 y6 o  G# n
window.onload=populate3 J7 y7 ^  m% V$ d( U: a0 f) h
% P* }8 N, Q! a# O5 `1 l9 O- L* S
function scrollmarquee(){# A6 R7 W& f1 f8 T$ S0 B2 ~7 e
if (iedom){3 R5 @' C+ |, O' Y8 U2 u; H
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
/ d3 Z* R4 Y7 y4 i+ T( \) R+ I" Jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' @, i1 {9 E% l/ [5 F# q/ selse
! B% v" S& H$ n; o5 ucross_marquee.style.left=marqueewidth+8
# ?/ e) l  }1 K7 z# C/ d3 N' Z
; B6 b, D# c7 T$ C% U}, U2 e. _% i+ E( P5 c0 Y
else if (document.layers){
" S. S* S5 _* n1 I6 Sif (ns_marquee.left>(actualwidth*(-1)+8))
0 C# B9 B2 W4 D7 _, w+ P$ ~* l# F) O/ mns_marquee.left-=copyspeed) |, N" _7 l7 n1 j$ T( E0 F( [
else
; }& k+ {( N" I- l. yns_marquee.left=marqueewidth+8+ [) ~0 b5 l; m2 V6 A* j: B
}
4 e. x: }$ a9 Q- R. X! a}
% U% E' M" Q, r1 {: g0 {
* `) f- I+ X5 A) v& V- M& oif (iedom||document.layers){3 x+ J& r! g( L: n, p# g/ J
with (document){
8 _9 N- |3 h2 y  ~6 y+ |document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ U3 f/ r7 W! u! F8 Rif (iedom){
$ D" K% W2 b5 @. Gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'), G4 I. |1 K7 K# H# G4 p
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 e; ~+ }" C5 L$ i2 ~
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')5 E; ?6 i1 U8 i& ^% @% p) G
write('</div>')  j) P. R/ }" b* B6 J2 E- A
}
) p! c9 H1 E. ~* ~' felse if (document.layers){
  y/ G; ]/ L1 s/ g) d7 C7 m) a- `- k! hwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 ]; A; \; H; G3 D2 M; Twrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' W$ u3 u4 X3 A) _7 O  \write('</ilayer>')  c: _' Q# P: ^4 h/ ]
}, r6 W" D+ X$ _
document.write('</td></table>')1 I& i7 r, ]8 j0 G% W  n6 f
}; j  R, r# v$ G/ z* Y# L7 j) i9 ]
}
* Z4 r- p) k* O# s# ~</script>

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