返回列表 发帖

网页之跑马灯文字特效

//修改宽度
! b* _( D0 P; D* jvar marqueewidth=300
5 c# I8 ^4 k* Y3 {% ^% r, T* f- Q//高度
% s# C$ V/ b4 S9 J8 l/ u' l7 Yvar marqueeheight=25; u! I1 W( }( J% b  u7 P  w0 d$ [) o
//速度(1-10)5 {7 k& V* K( {0 b0 o
var marqueespeed=34 H: X7 R8 W0 X0 M0 c
//背景颜色: R1 `! ~) s! c! \! N8 @. j
var marqueebgcolor="#FFFFFF"
: k% y! \4 e9 Z3 ~/ m//是否能暂停 (0=no. 1=yes)?
! H. J' N  e% J' p# kvar pauseit=19 S4 [2 a, d  g( B3 ~: ^8 I( J: T

7 t4 o% x( W! x* k0 _+ L//修改显示内容  |( n0 W) X  D6 ~5 E( C+ @0 y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'4 d0 g4 v; M1 ]0 d& k/ y

: y( {9 Z6 g8 |: w# [$ c* G% }
4 J0 }9 o0 }1 {+ h  l+ M////下面不需改变////////////; K  ~  M- i2 D8 X3 o! Q
# B' v2 S/ W( T# z
var copyspeed=marqueespeed" L$ S, h/ @# A, |0 ^
var pausespeed=(pauseit==0)? copyspeed: 0
  b9 z' M: _8 w( F/ O" G. ovar iedom=document.all||document.getElementById' ?  r1 H+ r- I8 S7 m) g
if (iedom)
' ~/ k) F/ m* M8 H" R% z2 Cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 w) E6 X; k; L7 l: l
var actualwidth=''
2 I" r: K% J$ f( W8 ^! l$ Fvar cross_marquee, ns_marquee4 U/ e/ K8 N5 d
: w0 \/ |0 S% C" {) ~2 e) k
function populate(){
: w: x; e" `' A7 M( m% S* hif (iedom){: M$ u! h: P+ E0 k0 R& k/ l$ u
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ K+ K$ C6 [# Y, S( V( V0 u
cross_marquee.style.left=marqueewidth+8
3 d; G+ K0 U6 E$ O0 G3 [cross_marquee.innerHTML=marqueecontent9 l" w1 M" h8 M  Z) x: ^3 @; M- b
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 P  L! I, N. a8 P$ d; ]9 K}
$ S! j! ~+ z) `: U7 @7 w$ Kelse if (document.layers){
. o) k9 L* _7 l2 n6 Wns_marquee=document.ns_marquee.document.ns_marquee2
* o. m3 ?8 v2 S3 e+ v0 B9 {ns_marquee.left=marqueewidth+87 l8 B, S, l; S6 b* Z" u3 P* D
ns_marquee.document.write(marqueecontent)
6 W' P: S" ~! s( y( V3 c. B+ jns_marquee.document.close()
) L3 Y$ n, ~; O! }actualwidth=ns_marquee.document.width. E7 ]- i; J, c# @4 K1 y9 [0 z
}
! B6 j1 T6 d3 _lefttime=setInterval("scrollmarquee()",20)
; m: R) l' u5 j9 h8 I}
. z8 |9 g9 w% S3 N0 H8 G9 H' Nwindow.onload=populate
7 ^* Z" M8 e% i6 q4 o9 W
& r7 w% E" u$ y- ^function scrollmarquee(){
! \4 O2 ^: m; z$ w% H  lif (iedom){- N& v9 {8 d" C. k# w
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% h9 \9 g( ^) j3 g: o
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed1 I9 i7 _6 B& D, F
else7 ]% h9 d$ I# m0 _9 A0 c3 V
cross_marquee.style.left=marqueewidth+8
! _! }% E& R+ P8 I; ]% ]2 }$ d, Q' p: t$ [9 [# i5 m$ F
}& T/ A2 M$ i' h7 K9 |/ l/ n
else if (document.layers){
7 s* j6 g7 s- f' |9 p7 T( ^if (ns_marquee.left>(actualwidth*(-1)+8))2 x+ i1 E' A  s, x
ns_marquee.left-=copyspeed
0 u( f: a" @& xelse
% Q7 Y3 m' ]+ H' tns_marquee.left=marqueewidth+8; W& O8 q2 m0 t
}/ f$ @4 O& I7 G' Z) b
}
+ A* V; s5 ?( ?- ^# ?9 z5 p" w% }( L/ e8 s# l. K
if (iedom||document.layers){6 Z& ^" q7 r/ C0 T5 |
with (document){" X+ B1 \) Z9 @7 w! U4 X# O% F
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
  R3 b9 R1 H% {. h# l' Eif (iedom){3 v) Z1 h6 U2 t7 _( \; f' v
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- M. T/ P0 }2 |3 P5 I: U- t' Cwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
' b* A: c$ s4 v9 F# Mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 ], v( q% O5 g6 Y2 dwrite('</div>')
  g( ]1 \2 D' n/ u9 h}" H1 _6 q0 k6 m
else if (document.layers){
: b# ?% g, h* t" z! Xwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 y3 Y" v, Y  w! E! h" j5 E
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 x1 I! [3 k, P! m% ~9 c
write('</ilayer>')
9 N/ E* g+ y& E. E4 N}% B" i+ o& t, }: i& C- K
document.write('</td></table>')
+ S' @$ F0 o+ d( B, D" s$ ~- O9 z}
. o! I6 L+ _' H& O* b4 k}
' V/ c+ M- G% l" \7 a</script>

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