返回列表 发帖

网页之跑马灯文字特效

//修改宽度
0 a* W! o3 T( U7 V: L( }: bvar marqueewidth=300( `) t$ {- m7 S7 F8 Y% E/ c
//高度3 \$ K5 V9 O8 d! e) f
var marqueeheight=25
. \8 y0 N2 X; U//速度(1-10)' C- X) F8 ]+ u: @. t' c! f+ h
var marqueespeed=3
3 g' p; L9 s0 n* N//背景颜色
$ k7 b. x  T# }4 Z3 I- Evar marqueebgcolor="#FFFFFF"" T' D0 `. ~8 X% |" E
//是否能暂停 (0=no. 1=yes)?
8 V4 x/ m. E) N: y. j5 }% Dvar pauseit=1. c& Q+ ^8 k$ E' Z; N5 s" `
4 i/ c5 l$ @6 c( G" h3 e4 x* l
//修改显示内容
; B' o7 ^) e- Z5 [var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') }* u- R/ A) F" @7 K& K" s

. ], x& f, o' a( H" t
$ F5 j5 E2 H8 l6 t* A, S2 s1 u////下面不需改变////////////4 k) {# L6 b. O* I5 |
+ e( D' G3 k: ?
var copyspeed=marqueespeed6 }' X- G+ @1 a: r- e
var pausespeed=(pauseit==0)? copyspeed: 0+ Q) A8 X3 d1 A, X; m+ f
var iedom=document.all||document.getElementById
& k. n6 n# [0 H; j9 e! D$ lif (iedom)3 S) C# g% j8 n0 p. ~* m* y$ E
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ O. ^$ k6 B  D7 \; F& Y/ Xvar actualwidth=''
  L. z1 q. U( t3 Gvar cross_marquee, ns_marquee/ N1 b8 F9 J* g2 r8 A% `

+ k8 N2 N" F& J# o* tfunction populate(){$ {5 E7 \4 T8 M6 y
if (iedom){+ k! O, Y. l3 @" K
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ ~$ q1 X2 j% }; M" o; q: J* z, B
cross_marquee.style.left=marqueewidth+8
. b/ M+ H2 u4 c% |8 v+ W( l8 u) Ccross_marquee.innerHTML=marqueecontent
# p. g6 n9 w2 c( W( r3 E' b" sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 z* ]6 j7 u$ i3 ~+ ]7 `0 y}5 y( J; I, f3 R. X/ W
else if (document.layers){& {6 b/ [2 r3 r) V, Q0 \
ns_marquee=document.ns_marquee.document.ns_marquee2
; _" O! Y. |8 v8 n9 ^) l6 Pns_marquee.left=marqueewidth+8+ K, m0 y/ R: B7 i
ns_marquee.document.write(marqueecontent)
8 g1 q% h. K; Z0 Hns_marquee.document.close()* d4 k8 Q  [- t: a
actualwidth=ns_marquee.document.width
6 \3 Y, z4 ^$ k9 q, Q}
1 [* i! m9 u* W9 flefttime=setInterval("scrollmarquee()",20)
7 I+ L. @* ]1 I$ P* E$ W3 d4 K}+ q9 a5 y8 H( }# U
window.onload=populate
5 P, O' i( [; x! B! A# c! i$ s- B0 D9 f4 d
function scrollmarquee(){
) H8 s) k0 w% k6 B+ vif (iedom){
0 k. W' F: V, c! U  a" O' u  T3 Zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))- O+ |, U1 Y' s( }2 L) C; y% ~
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. Y4 w& @( N2 s6 A) X0 Z1 Z
else5 N: J) G- F1 r& U
cross_marquee.style.left=marqueewidth+8+ k, O; i% p8 k, t6 {1 k3 A

, k+ y4 c6 m+ ^  N1 s2 P8 `9 z}
9 q# f: M& J' m6 X! r% ^# I9 T; ?- Velse if (document.layers){
$ h( \9 U1 f( ^: k* k7 U  ~1 sif (ns_marquee.left>(actualwidth*(-1)+8))
0 r8 R9 d& y+ |1 M, U" ]  {; v, Hns_marquee.left-=copyspeed
6 }- w! |/ H& v+ u7 p' l+ |! Nelse
; B7 R: o3 y9 e* V) y# j2 o) Wns_marquee.left=marqueewidth+8
4 J5 p% M- o  i}
. q! e/ \, C% J# A}0 W* E' N( \4 S% K
% U1 ^: Y/ C% j4 \4 k
if (iedom||document.layers){; K; E% D1 s/ `& D$ Q) a
with (document){
: \6 ]; z6 G' b3 Ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 Q' X; D6 D6 k0 i3 I5 s% H% S  Jif (iedom){. t  Q' q7 l1 P+ N1 n; t- m+ @' V  j
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! F2 o) c+ h( e
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- l1 f% x) v+ i
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ I1 o. z' \# ]8 ^( A1 F/ nwrite('</div>')
% d" s; f# ?0 A& F}. W/ F9 \, v% d. O4 f
else if (document.layers){
1 P  C7 I: V3 z: _- G. [5 H4 rwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' k, _! [3 \* k$ @: i- \5 ?; R# Vwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): g  h2 ]5 r$ A8 @
write('</ilayer>')/ P7 E/ v. {( D8 e$ _
}7 S; ?2 }! m9 V; N+ t! i) A. H2 H
document.write('</td></table>')
* }2 n* E. ]- D! B5 i}
  e' N+ s$ i* K0 ~. f+ L}
1 m( F' N$ k; x( H: T</script>

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