返回列表 发帖

网页之跑马灯文字特效

//修改宽度% ^# G; y: d: s, a4 ^
var marqueewidth=300: e3 y$ J% B8 U1 w
//高度
) B' r2 p; }6 r  R/ m" Dvar marqueeheight=25
8 K; i& P& i3 S) Z0 h//速度(1-10)( O) r' `3 o: S+ [' O
var marqueespeed=3: {6 z% a9 |" M+ y/ u3 k& `/ p
//背景颜色
" z9 W7 O" ~6 u% o" }. ^var marqueebgcolor="#FFFFFF"% B) g% H9 ?2 N7 \
//是否能暂停 (0=no. 1=yes)?
) M$ x- ~" I+ L  T! cvar pauseit=1
) U" t3 X+ T4 }8 J; ?4 |
* n+ N, Y) ^( A' d: x+ \//修改显示内容
# q% I1 F1 Y! O. S) f5 ~) T$ r7 {var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% c' u) ~4 g$ l9 {

7 a! Q, a) H( B+ C
/ y" ]1 c4 s# c) ^////下面不需改变////////////1 h: H) ?, Y. H8 l9 B; y

# I2 A% h! Z! G4 N4 {+ J2 ?var copyspeed=marqueespeed/ A: d5 Z+ V, Q7 z
var pausespeed=(pauseit==0)? copyspeed: 0
% ^: O& z5 [9 Rvar iedom=document.all||document.getElementById, M! O8 i* m# O, v& I+ Y
if (iedom)
" h0 X$ Z" L, l/ E/ [7 \( W+ Tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 s$ _4 C1 x# y9 @! Tvar actualwidth=''3 B$ i4 `+ ]; {, T; ]$ `
var cross_marquee, ns_marquee
& a( ]7 h* u* Z8 r5 e- s! _, n) j- G" U# H5 g" o
function populate(){4 x! }3 q( \- D, M2 q. d
if (iedom){
6 H( B8 F8 a, {. R4 {cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! @" h( G3 U. b+ r+ Wcross_marquee.style.left=marqueewidth+8& _! l1 D) z8 Z" m$ Z& u
cross_marquee.innerHTML=marqueecontent& @+ W& A' N. d: q$ u3 w
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; k. J  r6 M" A0 O3 I& W
}8 x& O3 ?& y7 \; C, N6 X" \/ q$ [
else if (document.layers){
, d9 Y3 `- d/ Z; S. Gns_marquee=document.ns_marquee.document.ns_marquee22 z& m" Y/ M: C' R! R! {5 w& |
ns_marquee.left=marqueewidth+8
5 i* n( h3 i2 H) Xns_marquee.document.write(marqueecontent)0 R: T9 D# ^- x8 K, o1 X5 ~* B- N
ns_marquee.document.close()
4 ]2 d- U3 }" Q1 [/ P2 n6 v9 `: S, Hactualwidth=ns_marquee.document.width
. a$ }) p4 u" `8 q/ q; J4 r) G}1 e' y# l$ m* s, {$ B9 ^) p
lefttime=setInterval("scrollmarquee()",20)
3 I5 k3 q( ~! l  Q+ @}1 k& _2 c! _" ^% r, _( K  F$ y
window.onload=populate1 {4 u5 j+ z. }& ?2 ~5 d7 A
6 g( q: Y0 j$ _
function scrollmarquee(){- `6 s7 K! g- N1 r. O8 p
if (iedom){. K/ Y$ K( d0 P* |
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& e5 ^. @+ J4 W0 C9 ^$ o5 Ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* E, o) S7 y# P, B' x2 c
else7 C7 L5 F0 ~' v' E2 H, @) w
cross_marquee.style.left=marqueewidth+8
1 d1 y( W1 O" j1 M# M
1 H: P, V! t; K( f}
. I6 Q( L. P5 _, s, Uelse if (document.layers){2 @# S' P$ j4 B; U1 P7 c  n
if (ns_marquee.left>(actualwidth*(-1)+8))
1 o' f& o  l. y. V& Pns_marquee.left-=copyspeed/ c, W* V( ]* y
else7 _) j8 c2 Z( i4 c) Y( h
ns_marquee.left=marqueewidth+80 j5 _, J; c2 \* X5 X
}% `( R' T4 w& l5 c
}
1 N- l! ^3 |" q* m3 I- B' P, x9 G4 R" X
if (iedom||document.layers){6 M# h# a5 A( O0 u# p
with (document){
  K( ?  S+ ^" N' p4 i3 z4 ~* Vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 u7 ^9 q! I2 Nif (iedom){  h" v) b% J$ Q' g" Q3 p& u
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( n8 i2 i; Y4 m* uwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
  A4 V+ D' f& m$ U/ d8 L1 Jwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 c( V" p% j; `, |  _$ R# n0 V* gwrite('</div>')
" y  B( D, u& d}
/ n  x6 X( g4 S/ i9 Melse if (document.layers){
2 X/ W  I# p, t0 Lwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ B! c, |) @, Bwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 Q4 Q8 u7 {! |! r9 s, J( J9 Rwrite('</ilayer>'): P2 b7 f6 p5 R: ~; j
}1 G9 h. |& Q8 q' J7 F4 a& f
document.write('</td></table>')- I2 D  k2 u: M/ R% B1 Y$ |
}- q! M1 o& h  ^3 {) J
}: n$ k  J$ R4 s% ~2 s
</script>

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