返回列表 发帖

网页之跑马灯文字特效

//修改宽度
/ x( c1 g5 N; Q) L- Lvar marqueewidth=300
1 Y( V! X% Q! G1 ^, M//高度
5 r8 q8 t! M! W, jvar marqueeheight=25. r7 J& X5 h) O
//速度(1-10)1 |3 I- B# ^+ P) |" b
var marqueespeed=3
- M3 F8 b; `' U1 w! g//背景颜色
" c, P2 S* U; Z  }( j2 \* q% Kvar marqueebgcolor="#FFFFFF"
+ l- I" D5 U8 `$ D//是否能暂停 (0=no. 1=yes)?
0 A& e1 j- t4 O. Vvar pauseit=1
4 {3 Q; x+ ]! _. t1 u, I3 n9 K5 |. G8 e" {& X& i3 }. x# y8 p
//修改显示内容
& Q; J7 E$ ?  s5 d( X" N  Gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>', J* t, E' j/ J/ g

0 }6 O7 h2 G6 q7 w4 O, |% D% m2 X
. x; ?) `3 j, s3 p3 y6 X+ [5 |////下面不需改变////////////2 o/ t6 }1 |  g/ U" P; j

1 `6 M- a$ s( r" V3 E6 s! N1 ?5 ivar copyspeed=marqueespeed
0 Q1 y1 J7 m( r) T: s5 B) r3 A7 jvar pausespeed=(pauseit==0)? copyspeed: 0
4 E' G7 E$ W1 R  ^; X8 c6 Evar iedom=document.all||document.getElementById
9 [1 {) I  M; J5 `2 W5 Uif (iedom); [) U5 O( V* U( ^, j
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' q1 I2 d( l  \0 `var actualwidth=''
& ?$ d: @  q! j. S) Jvar cross_marquee, ns_marquee& p* v+ T) o# G0 ^
; l( {2 _  ~; g1 |3 ?& q
function populate(){
2 {! z$ s4 C% G3 b9 m/ h2 }, hif (iedom){
0 C0 \, x  e" O! g* L8 @cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 A1 H' F4 [& y) P) q: i2 n- J
cross_marquee.style.left=marqueewidth+8
9 v, v  j$ @1 `cross_marquee.innerHTML=marqueecontent* w, R! Q$ a, X% \, l
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  J9 P( a0 p) x$ c1 H  H2 W8 F
}0 Q' H* U) s1 l$ p6 Q1 p
else if (document.layers){1 b6 B# C% c* t, y% o
ns_marquee=document.ns_marquee.document.ns_marquee25 h  A6 I3 X( |2 z- s& N  P( g
ns_marquee.left=marqueewidth+8" l! x9 r7 b7 O* W* V3 R1 B
ns_marquee.document.write(marqueecontent)* G1 M3 N8 ?' l
ns_marquee.document.close()
* H* A- t, \: a4 {9 d$ bactualwidth=ns_marquee.document.width: y7 V; T: Z" Q
}
' y" e9 t6 W& X# plefttime=setInterval("scrollmarquee()",20)
  G2 Y, S2 H* X; I' g}
+ @0 L' Q2 j3 s$ Q1 bwindow.onload=populate% F3 |. r; M! [0 g2 ?+ ?
2 `+ Q( l7 d/ n! a% ^1 |; f( c
function scrollmarquee(){
+ w7 u: V6 G4 vif (iedom){1 H. c0 j6 y; L( W9 T' }
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 G: L5 `1 c/ [9 Y0 ^% j
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed  I) s+ U4 O, o5 c+ c7 C, m
else
& t$ _/ z- z4 ]* L3 Rcross_marquee.style.left=marqueewidth+8
+ W/ u6 D, Y. z6 s+ l; M, G# J
- z1 H" `! j) @5 l+ c}. N, h2 P& \  O
else if (document.layers){
. a6 u( o6 ^' Z$ i2 Hif (ns_marquee.left>(actualwidth*(-1)+8))
- T8 M2 O+ h$ v, A7 t& Uns_marquee.left-=copyspeed
( w$ D5 u: i: b* ]1 Q8 X# celse$ a& A% O7 W, Z& W( D
ns_marquee.left=marqueewidth+8
; i. X6 y7 c2 m" Z}1 S4 |9 ~  r" O- ?% k; Y0 A" E0 _, p$ Q: y
}
4 ^" Q. x6 Q, M+ f- @: }" [6 J. I" Y& R% F$ ^4 f' e- i
if (iedom||document.layers){. t! Z0 n" T( r
with (document){- f5 o/ s# ]5 A" H
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): Y, G3 d9 c: y- ]
if (iedom){$ j  a% m$ B, V$ |" P
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 L2 U' A0 [1 C) q+ _9 ?1 }  p" G5 iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 K  k/ W) r" S- o! B/ u; A( j
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, ~2 e% n3 E' m, i7 ?' wwrite('</div>')' G+ M+ W: F' e4 O
}0 m1 k/ e1 \; l8 }/ ]
else if (document.layers){" P& f4 t/ X) {
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 Z7 r8 T9 \: Xwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* E7 Y+ H$ c& K
write('</ilayer>')
7 }, f- i3 a' u6 u}
7 [, l1 _, k4 ^' Y0 Adocument.write('</td></table>')6 L- q/ N  N2 u
}! x, M* E# B" U) Z
}
+ ~1 I( d5 g: w& |</script>

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