返回列表 发帖

网页之跑马灯文字特效

//修改宽度& G7 f0 Y5 C$ R/ l$ {, _. K/ K
var marqueewidth=300
9 Y, e' g5 W5 q, Y1 D. e7 b9 _) l) p//高度. S6 q0 }8 `3 q: [
var marqueeheight=25/ S# f! _7 I4 q. [. _3 `6 H
//速度(1-10)
- R6 k! ~: i: c% zvar marqueespeed=38 e. m3 {: O1 Y& d
//背景颜色3 r8 ?$ S0 o2 a
var marqueebgcolor="#FFFFFF"
% T: U. v& S- v& h) o, J  t: o//是否能暂停 (0=no. 1=yes)?( D: S$ m3 ^8 y5 K( e- z" P" D% n6 U
var pauseit=1
" ?8 s; O. U% o6 H5 A: e" z  s; h+ |' [" W$ e# W
//修改显示内容
4 R  g! V7 V, @( d1 e% Tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
  O) D( [. x! R! j1 M1 o* @% j- Q6 x* A; F+ G

! E' w! c* M! i4 V////下面不需改变////////////* P) B( {4 b; W4 q0 Z5 J6 y

& f8 R* l& c9 C# k$ b3 E8 @var copyspeed=marqueespeed
( ?/ j3 _, M) K  e" p+ Wvar pausespeed=(pauseit==0)? copyspeed: 0: Y# Y& f! Z  g% Q3 E% m: d% X
var iedom=document.all||document.getElementById
8 ~2 q: r0 A7 f6 X6 o  Lif (iedom)
( w6 u" Q" C7 s5 F2 ddocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')8 i9 I5 N3 X! d1 r
var actualwidth=''
- G' A! H) o0 F" ^3 Yvar cross_marquee, ns_marquee& W5 Z: T) Y% h

# a* w3 ]$ b2 L# |3 D. r; @function populate(){
  u4 c- k! T5 f0 C1 Dif (iedom){* n1 b9 g' p4 G0 W8 F
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee8 `, p" ^" t% K% j7 q& z# V
cross_marquee.style.left=marqueewidth+8' ~) U0 u% s& d; j
cross_marquee.innerHTML=marqueecontent/ d' G" z$ ~9 p
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
  `6 l" w8 c2 f5 U% N: q: V# D/ P}, n3 [- q' N% s: N/ Q
else if (document.layers){
; e7 p: P( V0 `3 j& \ns_marquee=document.ns_marquee.document.ns_marquee21 D( l2 ^2 D* W0 x
ns_marquee.left=marqueewidth+8
6 c  |7 a, g6 `0 W# I8 A7 K' Sns_marquee.document.write(marqueecontent)
# J0 e9 _4 P4 X  L/ U: [" ~  @ns_marquee.document.close()
" U5 C! E( q" ?; }. f% _/ Uactualwidth=ns_marquee.document.width( Y" g" `7 n$ c, u. t4 N% q
}
; A- H& V- L& S$ O& plefttime=setInterval("scrollmarquee()",20)6 Q4 T" b1 c7 |0 @4 h/ ~
}
1 d% `( [3 E2 x) j+ o0 Z* dwindow.onload=populate$ V9 N$ X1 r- _: L) K4 L

1 b0 k7 M" _: ^, n& w- A; [7 efunction scrollmarquee(){
' B$ q7 Q, C& G/ n- yif (iedom){3 H- O$ K( k0 S+ ]9 @" G
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! t/ T/ V7 @6 O  e' K0 ^( l  R( dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" |: v) X9 |' o1 ?) j3 `
else
  u) i5 g, F8 q2 n; Ecross_marquee.style.left=marqueewidth+8
  q3 O" [4 I* ~  W8 n+ K8 n  c4 q% w2 ~4 z/ l
}
% c% z; h1 L2 v2 g& M9 S/ p0 x4 selse if (document.layers){. S! }3 D2 e, @
if (ns_marquee.left>(actualwidth*(-1)+8))
' `# G2 l0 V/ X1 l8 q5 t# T' T& Gns_marquee.left-=copyspeed3 R( f" x, y; s# L9 Z+ f8 K+ I
else) `7 d0 Q) G% I8 J1 r! B1 N, W- o8 E
ns_marquee.left=marqueewidth+8
" l  t% H3 M$ X; V}
+ \/ Y3 E$ k: a* [: }}
; Y$ r1 A+ t8 o" J
3 h/ \- e' k( r" m' B( Dif (iedom||document.layers){
; u7 e8 t3 E/ X+ S0 l5 j# t; dwith (document){
" _, }; I3 O8 L  {document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
* i; u+ b/ b) C- m# a3 vif (iedom){
( M5 Q$ d( D+ ~write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 ~2 i& V5 e5 Q6 l+ L+ W
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 E  i1 Q$ ]& V+ d
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; P) E5 M* ]7 nwrite('</div>')
, ]0 Q- P+ ]- ~$ B1 v" N. I}
* U# S5 r( l2 }2 F8 jelse if (document.layers){
' N: g2 u1 \7 a! H4 Fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 ]  D2 x) H! R+ q$ x
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( f+ |# D& `& x( R% ]5 r
write('</ilayer>')
0 Y9 Q2 R* Z0 n}
: K/ S+ u1 J' Y, |0 b2 [document.write('</td></table>'): ~  M1 i1 M( |( q
}3 P( h+ g" j4 F2 y( ^
}+ D; \' Y" E) B* ~7 \
</script>

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