返回列表 发帖

网页之跑马灯文字特效

//修改宽度0 d0 @! e$ K; I) y- ^4 I
var marqueewidth=300
# I  [, T' G4 N. b0 L//高度* G+ G) e- D2 s* m% F, Y* A# A* R
var marqueeheight=25
5 `, I4 W- u- L' X, Q8 u8 \//速度(1-10)
$ [# r& O( I4 {var marqueespeed=3
5 H( ^/ r5 g3 H  @# c+ {) Z. v. m//背景颜色
$ _$ S1 C; z4 i% `5 L) j- u7 Lvar marqueebgcolor="#FFFFFF"
9 s' e  m  R$ F//是否能暂停 (0=no. 1=yes)?% B" t0 K1 M# z0 u& ~  A0 V6 T
var pauseit=1
4 L8 N6 m1 w% z4 B/ S
7 v6 d% r& f2 _1 n//修改显示内容7 w+ Q' M$ I- G! I  P8 A
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* Y: x* M" ]/ n) B4 u. D& Y5 |7 ]- J' p9 O- U! u. L

. X4 H: v: j$ t. M8 D////下面不需改变////////////
1 z' C+ P3 o8 _# C. }  k3 H0 x7 G1 A8 w) P+ T0 k5 ]
var copyspeed=marqueespeed
: K' v: b9 S6 o  @var pausespeed=(pauseit==0)? copyspeed: 0% U; l% T3 t. K, M# V1 w; h/ |2 |
var iedom=document.all||document.getElementById
3 l% P6 ]( h/ e+ i; I1 mif (iedom)$ E- P, y3 L6 F; |8 D
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 \; C6 B1 U! V- Pvar actualwidth=''
/ _; f/ b- L$ Y' J0 Z6 _7 v" Kvar cross_marquee, ns_marquee, T7 [6 M: l5 G3 N

3 H4 J( I  }- w4 Nfunction populate(){5 ?4 u* C; W& F" y% x. o4 ~$ ^/ n2 P
if (iedom){0 g3 d. c- D- y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! L( v, W: q& b* B1 u3 T- @cross_marquee.style.left=marqueewidth+8
; t8 D, o" c( Z+ j2 n4 ocross_marquee.innerHTML=marqueecontent
3 }! M1 h9 f" c7 E, F$ s8 t/ Oactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# `5 v5 l# {( i2 }7 ]* V
}
0 n' W1 n7 M8 eelse if (document.layers){
% \$ Y! _7 j( Y  Ens_marquee=document.ns_marquee.document.ns_marquee2
9 n% J: n* O( lns_marquee.left=marqueewidth+8. H4 ^  q4 U  k- i# D1 [: y' e
ns_marquee.document.write(marqueecontent): c: d( o: x# v6 b6 b, D& S" K
ns_marquee.document.close()
) i0 X) U9 s1 l9 [1 G  cactualwidth=ns_marquee.document.width
. B5 p+ t0 B& L; l}
  j+ _9 x9 G' b. glefttime=setInterval("scrollmarquee()",20)& f3 o0 t# J" U, W  R( I
}) i  G' L3 H( E. B$ n/ B
window.onload=populate
0 d1 {; t; C. i0 h% j' F9 E4 C6 a' s  O
function scrollmarquee(){8 L1 L. ]9 Z0 P& L: q/ h
if (iedom){' U4 b0 ]7 t" W, k4 J
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# s7 _7 F0 K3 O& a" Y( }cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 E; C5 I) U" [, K' R+ Uelse
5 @1 _# b4 d; T; l( b  s: T+ wcross_marquee.style.left=marqueewidth+8$ Y: [5 Y7 s- X. Q) I5 V+ I0 b

' S6 s9 k# C0 ]; d}
. d7 s( S( q5 r0 i" Gelse if (document.layers){( _  w" g+ I( |* ^
if (ns_marquee.left>(actualwidth*(-1)+8))
% r; F1 K3 w" j- V6 q( [ns_marquee.left-=copyspeed
$ b8 ]8 ?% v8 k: I* welse0 q4 A) m6 g7 z; j( \, x: {
ns_marquee.left=marqueewidth+8
0 d: B, `* T& r! A}. t* m$ g- |4 w5 g
}8 h0 O  F0 ^' y1 x6 O8 ]; r- s
! N2 a2 W. k5 E" O  _: J# \5 a+ n
if (iedom||document.layers){
: ^9 _1 H+ L) P. Kwith (document){
! [7 w  U2 q4 P' c& f, E( Ydocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 x% h, s) g" ~/ v0 ]$ ]2 R
if (iedom){
0 c' c5 A! Y. d( V; j+ {0 ~! cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 J2 X+ k9 S$ I) }: f
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): F& H5 S* F$ f
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' l2 @$ F5 f/ n
write('</div>')9 z& k4 e4 m3 ~8 N- v
}; o, y4 G7 P3 s) h) N
else if (document.layers){" o  `% P/ B1 f" P
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 y! Y- v  ^0 }( \; f( [write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ o) W2 t% o& y1 t7 t% L
write('</ilayer>')
* {* x2 p7 P5 I1 K}6 S) L- W' y- {9 N: J- h  ]( D1 X
document.write('</td></table>')
2 D$ ^7 S. E9 r* M$ t8 u# y) t}
+ m0 C; \% `0 S) e}" V* I+ E! g! x! a' n: \; D
</script>

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