返回列表 发帖

网页之跑马灯文字特效

//修改宽度
/ h+ B2 C% R0 Q' q4 j; Bvar marqueewidth=3005 K& p+ i+ H. b( X6 }3 _( L- u
//高度" q$ l! r' s1 n2 _: a, K! I  x5 z# {$ e
var marqueeheight=254 P9 L8 W- I" p" Z
//速度(1-10)  H' g' H! K, Q* Z2 F8 E/ g
var marqueespeed=3' F' A9 Q& U3 L  e/ i
//背景颜色
+ C  s* z, b" i* q& pvar marqueebgcolor="#FFFFFF". _; n0 d3 l% }& E6 C" A9 c' v: d
//是否能暂停 (0=no. 1=yes)?
6 g' u% o# F" l* N$ I; Gvar pauseit=1( y) b5 U7 Q' J: M, W! n
" Z- ]0 M% C" J) a& S+ Z+ t
//修改显示内容/ l# @9 N# q& V5 t3 c1 O
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') P8 T8 s* w/ _& C3 U% h! T
% H: x6 K3 B/ M5 U' `# U
* M1 d& V$ w8 O7 s
////下面不需改变////////////
1 R  w& V2 D: s. ?- m1 V0 K3 q' s5 j5 u
6 \" S/ }  G+ R# f: f+ n% ?0 ]3 Wvar copyspeed=marqueespeed) f5 P9 ~+ }+ W6 Y, A( ^
var pausespeed=(pauseit==0)? copyspeed: 0$ h, ^" c' [/ R
var iedom=document.all||document.getElementById
, N! R, f$ P5 [if (iedom)
7 d1 s6 J& ^4 k5 Xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
! q0 f, y$ c' ~/ O. z* lvar actualwidth=''
# U& M- S" t/ G4 S3 ~) Gvar cross_marquee, ns_marquee
+ n" K4 g  c3 ^- N5 U) T
% s% W- }" {$ Y: V# E8 yfunction populate(){4 o1 Z$ d& ^  O  }' k1 N
if (iedom){
3 N; U+ M( u' S7 Y! [8 Jcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; j% H, a/ A! T9 X9 u3 E; W
cross_marquee.style.left=marqueewidth+8
& I( t1 B8 E' H+ v  a2 }3 Y! ycross_marquee.innerHTML=marqueecontent3 T% T1 T: Z$ c& o* C, Z6 i7 ^. L. B
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& t( F( V7 X+ O" w  O1 B}
) Q# k6 N4 I$ J2 r) a1 Helse if (document.layers){2 E; y% h+ \& j) C5 n  r9 A
ns_marquee=document.ns_marquee.document.ns_marquee2: M& h) g$ |" y* c* v- {5 y* \( F% C
ns_marquee.left=marqueewidth+8
, k' D& b% f# L& w( `) Xns_marquee.document.write(marqueecontent)
+ g& n9 u# M+ L) R$ Zns_marquee.document.close()8 a7 h* P+ V3 M8 f7 J/ T/ w
actualwidth=ns_marquee.document.width
( n: T$ H8 u! x}9 o2 W0 O& t6 }& ?1 E' [
lefttime=setInterval("scrollmarquee()",20)
& ?( t/ b9 b; d  }; t: |}4 x: D8 f& q" x2 s1 E2 i
window.onload=populate0 }- e8 n" l/ q) w" ~
, H- [8 Y+ n+ T6 W) |
function scrollmarquee(){, L- J$ S; s: P/ p
if (iedom){$ \4 p. h- H, `1 w
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) }! a: J$ x5 n# ]4 I1 P6 Jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 H5 t# t7 b' p6 k2 D1 {
else
- r8 ]$ c" Q- u1 o4 ], O% Dcross_marquee.style.left=marqueewidth+8
  C. r9 Z+ X1 Q5 q8 I2 U% X& v2 I/ P9 H7 e% g% e
}
1 t$ O3 r" s0 U! k7 Welse if (document.layers){8 F; G$ j/ ^, P) d  L- |2 W3 {/ N
if (ns_marquee.left>(actualwidth*(-1)+8))
$ z  Y! @& ~7 L% ?$ {" ?ns_marquee.left-=copyspeed2 A. D6 ?" i. v2 t5 N5 |
else' Z6 F, w; o; J8 ]8 u2 N$ h
ns_marquee.left=marqueewidth+8
# i! h: [+ c+ \. B1 c! A! I9 b" x}! s1 s7 I/ ^/ P# E( L, E
}
5 }, @" ]! t5 _# _4 _: r% D9 o( {6 F' v5 @, A
if (iedom||document.layers){
- H1 Y3 C5 h" @2 ?+ ywith (document){& b; J) K& |! t
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 K# @2 ?/ c, e( [# v
if (iedom){
0 J7 Q$ A/ F  l1 t1 j, Owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): F/ C& N! d; c+ B5 F5 d7 D5 y" J
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). o! ?6 v6 A$ F+ T
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& Z' B9 s  x8 X! e' D+ uwrite('</div>')- n" m9 j& j" R) ?. g, X
}
' i) r: p1 M' G. v& eelse if (document.layers){+ \9 q4 m" k" @$ M# i
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* l/ C! H) p) u: ~8 F9 ?1 w0 F
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! N6 ]& z% x9 k! t, E! a- Lwrite('</ilayer>')
0 J6 {- `' f; q: |; Z}. q2 I/ Q' |1 y2 V5 g# P" o/ }
document.write('</td></table>')
6 `' d3 Z6 A# F1 T+ w5 \1 T}
% `3 `1 {6 s% d}
  n& J6 h* w. i9 e& Z8 }% X( B</script>

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