返回列表 发帖

网页之跑马灯文字特效

//修改宽度0 d% x  F7 t7 l1 A: U4 x$ [
var marqueewidth=3001 R" B% h$ O' K
//高度
$ Q- R8 A0 A% vvar marqueeheight=25
0 M4 z2 `9 M) _' W4 ?8 l* T5 d//速度(1-10)
7 b# S; C. B# _; Bvar marqueespeed=3
7 u$ c+ O# B" e, i3 e//背景颜色
1 ]" c6 S- F7 |1 Pvar marqueebgcolor="#FFFFFF"
5 G( C: `7 L" W! h8 W  F9 s6 g. ^0 s//是否能暂停 (0=no. 1=yes)?3 d3 e! T' \5 z4 ~8 J1 W
var pauseit=1
8 r* k& |, H) ^+ z
8 E8 \- k& X3 G; [: [( K/ |//修改显示内容8 \3 q' B7 N3 M6 m
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" d0 C5 y$ L( K# D+ ?7 I0 K) |1 t4 x) y( L' ?' p& t. a: R- i

3 u5 W2 x3 M' ?! C5 V& \////下面不需改变////////////
+ Q' B$ U" c3 u) m/ A* I1 m" R- Z* D/ y: o
var copyspeed=marqueespeed9 F3 {' h# e9 m2 C8 O
var pausespeed=(pauseit==0)? copyspeed: 0
7 B4 I7 l2 R; V3 |' L2 |var iedom=document.all||document.getElementById
6 X  C. {8 n9 A- Y. h0 lif (iedom)$ a) P5 E$ {& r  E1 o/ V
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ z! D. @4 p& S2 k& Yvar actualwidth=''
: u( V* I& x+ X9 t7 T6 f* Nvar cross_marquee, ns_marquee2 K3 t4 G1 w5 S) v+ X* Q

7 Y- |  ~, H$ ?$ K/ E. W! rfunction populate(){
- j7 N. c: F2 l  H8 dif (iedom){2 H+ @1 S& U, m/ O; W4 o( o
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 V' X& m, [4 s1 ]+ E* m/ x8 a6 V: mcross_marquee.style.left=marqueewidth+8
+ o: b$ [, I4 J. f" zcross_marquee.innerHTML=marqueecontent9 e# B# |6 w8 B$ O, G/ N5 X( t3 {1 k
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# V. q, g* w9 g
}8 j) i  s8 l8 O. L+ W
else if (document.layers){  r  {4 V- {; _9 x; z1 Q
ns_marquee=document.ns_marquee.document.ns_marquee2
. B, H3 q7 s8 L1 pns_marquee.left=marqueewidth+8
7 Z8 ]+ |- H% j" W, ~; a. Vns_marquee.document.write(marqueecontent). T& x4 |7 V( Z; K' ?
ns_marquee.document.close()8 v2 b$ m3 x, @, P- n
actualwidth=ns_marquee.document.width( }6 n! e6 w9 |5 ~" a1 g8 u
}
; R. {. {8 A- m& E' K8 ]# C: O8 Ulefttime=setInterval("scrollmarquee()",20)' t* d0 I  l& K5 E. X
}
1 q/ ]8 y$ S- l+ x- M( Y, awindow.onload=populate! _: J3 `) n3 B+ U# p. h

# g0 a9 A( N) g1 o; ~# R& hfunction scrollmarquee(){
- ]) L/ Z" q; _! M) z+ n, Wif (iedom){" x( K/ `. i7 r
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 u+ F/ U' H( i: H7 i& ?" D! w, Z7 ?cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ \7 d# }5 g5 k, B$ ]4 ]8 V
else
, T2 Y- v) [0 n9 @" `cross_marquee.style.left=marqueewidth+8
& s9 O2 l# ^6 B( f; C; L  t7 g
. L% X/ `) {6 A8 s( E- q/ H1 _}( b# q0 ?; A% W# g- V" [3 C
else if (document.layers){' S! J/ Y8 t3 I0 P! U
if (ns_marquee.left>(actualwidth*(-1)+8))! z1 o) \5 \$ U
ns_marquee.left-=copyspeed% l# Y0 j. \6 W4 k
else
1 [2 n* q# n0 F2 N# p  jns_marquee.left=marqueewidth+8
6 M+ z4 U  Q7 g: l, J7 C  A( l}) ^/ A4 T) E6 g" \
}; |7 w) b. D2 Y7 E6 |
$ w6 N3 d) m8 l
if (iedom||document.layers){
8 o2 T! \8 b% b% }2 {3 Kwith (document){7 j* l  n2 G" x. j) Y/ ^8 O
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- Y% Y7 [- a& R) G$ r0 C
if (iedom){2 s: V" t; H0 T+ o
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* y8 [7 Q# A! n/ V
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- V5 K/ H3 a9 ^7 j( N& j3 c
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; A% V: {, `+ u  ]  g% f& ~; O- V" p  bwrite('</div>')
. w& c0 B! p4 p8 }  o}9 |. ~7 v$ R: P# h& [: M
else if (document.layers){
: T" L5 I2 y, x9 b" xwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% {, d: ^+ e( Q+ o8 m+ e  S
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) g% Q% l4 E; ?, h. swrite('</ilayer>'). z. H3 l) E* _. U1 y
}9 i1 ?! L" d; }$ Z
document.write('</td></table>')
; ^" {( n  @1 G# k( n}
2 F7 p: N  z( O& G}
0 q  u" H! ?* Z% `</script>

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