返回列表 发帖

网页之跑马灯文字特效

//修改宽度
  N8 D0 Z5 I8 v! ?- k6 ]var marqueewidth=300
3 \8 I0 i$ z" G) B" t; w- v& @. n//高度
; N& i9 A9 ]! k7 t7 ivar marqueeheight=25- }& @2 Q) }2 ]" Z; m+ T" @
//速度(1-10)' Z, U0 T% ?9 O$ b
var marqueespeed=39 M% G2 O3 p$ q
//背景颜色
* u: A- z7 u  L2 P! \5 k2 I' `var marqueebgcolor="#FFFFFF"$ u) J/ Y# q  p8 X( U; W1 h
//是否能暂停 (0=no. 1=yes)?
: V+ h2 _! c9 _; G) n: ?$ qvar pauseit=1
3 F+ h4 t7 ?% Z8 V, y7 f: U  s! N5 y5 I0 ?
//修改显示内容% i( j5 x% k3 ~2 B
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& {$ {: Y) D- a; n+ d4 V  V6 L9 B
  G3 b& r. b4 t8 w( R7 [

% \( S% _& d$ Z& `////下面不需改变////////////
% m  ?# ?0 Y: e6 y% S8 }+ ?+ i1 [7 r( Y& f- \* [
var copyspeed=marqueespeed
( m9 x4 n( Z* ?6 }3 {; N5 Tvar pausespeed=(pauseit==0)? copyspeed: 0
3 u# A0 v: D3 [( U4 W, D" }var iedom=document.all||document.getElementById% Q9 z! h* O* j: i. G4 x1 c% p
if (iedom)
) g# r1 v: J* U2 H7 Z1 ^' H7 h" Gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')- N; _/ M+ w0 `- r# d0 U2 ?
var actualwidth=''
- R* W' \: K1 d( S" yvar cross_marquee, ns_marquee
: M6 t' f5 y0 H; a* _$ P6 l
+ f6 R6 e5 m5 R! ?2 {function populate(){
' Q6 x+ u! T! v' Q4 L- {if (iedom){) p8 q3 `2 n' ~# b
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 G9 Y% ]- u" u6 u$ I2 g* pcross_marquee.style.left=marqueewidth+8
" d" o% \9 w4 _8 _cross_marquee.innerHTML=marqueecontent5 r) q: c9 f  W1 G2 w, N! Y" f4 Z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 I$ }  f  \% K% X- y
}0 ?7 L* p! M- U
else if (document.layers){
) ]( h/ d5 E: Q4 j0 Wns_marquee=document.ns_marquee.document.ns_marquee2
' s0 f* k! O& Q8 Ons_marquee.left=marqueewidth+8# F3 a8 h. z, T+ `! e9 p2 @
ns_marquee.document.write(marqueecontent)
2 T) n* K" L. u7 Z  s' Qns_marquee.document.close()
; m0 n: B. f6 _& A6 o- x" Lactualwidth=ns_marquee.document.width1 h: l* y9 y& A- r/ R0 O
}6 P; ~* x8 H5 P5 Q* U
lefttime=setInterval("scrollmarquee()",20)0 h+ M2 U7 A) C! q$ i
}! |/ B2 ^6 K1 ~3 o# a. {$ S
window.onload=populate
2 `, [2 D/ x* M. C. r8 ~: t0 o
% J' E6 n& {# y* Z1 n! R7 Yfunction scrollmarquee(){- q" [- Y  J: x7 }: V% U, U1 l
if (iedom){, P2 M) a$ o  }2 N5 f' z# s) r
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))4 B: E0 a$ ]3 e- ?* g/ J% |1 ^
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
- u2 k2 @/ h4 H1 Z0 t& Relse. j; |4 @. ^  E8 }; a6 Z  F
cross_marquee.style.left=marqueewidth+8
$ B% @. ^0 \- t. H
$ |" L- i$ t) j$ f}1 V6 O+ e4 C, X: s3 v. f; n
else if (document.layers){
; X; p+ e: o2 F# d- S9 Gif (ns_marquee.left>(actualwidth*(-1)+8))- ?  _, d: e( z+ v3 g( u. Y
ns_marquee.left-=copyspeed
  J/ g) O$ w/ m* J) Y" B. P2 |% d  Delse
$ {. P3 m# b( E/ c3 q1 v  X. Gns_marquee.left=marqueewidth+8
' E) N( r  d3 L$ o2 F}1 I! c8 @5 }7 U% L1 B8 Y
}
; T8 q4 T0 i( H6 N8 }3 P
- `7 A5 h0 T, k  Z, ^, Gif (iedom||document.layers){! R% A: J4 i# M/ t7 c
with (document){; d4 C" \) T* G* e) i. K
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) b9 i4 P$ ^& M( i
if (iedom){
5 a0 {/ S: I6 V- {, Xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
  N" }- Z4 }& c& F9 i0 [; iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 h: U( y# P# J( `) C, ^write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' F# j7 R0 p. h6 m8 }( v4 Gwrite('</div>')
% i  ?3 V7 Q, M9 C! h. |9 u0 [}$ b( t0 ]' P8 w0 G' Q2 O' B
else if (document.layers){
' K( w) B$ _4 Y9 x# ^9 nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* Q. F4 V# E  {
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* i$ P; D. m# p& |" {write('</ilayer>')$ x: k1 Z4 a0 o- D) l
}
8 Y! q. v# |) Z7 B8 W: T  ldocument.write('</td></table>')- c8 X  Z+ W0 ?6 O, c& z/ o5 I
}5 L' H- j' W6 f6 ^
}
5 ^5 ?6 K1 C( w0 P+ I</script>

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