返回列表 发帖

网页之跑马灯文字特效

//修改宽度
7 Q; ?) V# k/ t. C- ivar marqueewidth=300
. A8 M) A9 Q% i3 ~" b. p. X- r//高度
; R- E: C. H. j# ^var marqueeheight=25* M. B, h- C( f/ z9 B
//速度(1-10)' W& o2 i8 k  t9 K  }
var marqueespeed=36 O# c0 J% p) J
//背景颜色
& V- n4 G% b& R6 F$ _var marqueebgcolor="#FFFFFF"' d' B/ s& g7 W1 \$ g
//是否能暂停 (0=no. 1=yes)?
7 k9 W/ G9 ?. z3 W+ Z/ S# Wvar pauseit=1
# ?9 j" ?2 T* w6 |0 k" ^' i: B, m" y/ |, [$ E, \* A! P( ?6 J, {0 H
//修改显示内容% N- ~2 H0 x- N% U2 V" v6 `4 j
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( w0 T4 q3 b0 a1 g" G3 L
$ U7 {1 T. p  i$ `8 f! q* R3 H: _' A* j
////下面不需改变////////////
$ N4 V5 H5 F6 E, U7 k  c
$ \' r) v% }7 I# Avar copyspeed=marqueespeed& H; ?0 D. s4 a# e. o, `
var pausespeed=(pauseit==0)? copyspeed: 07 u: v8 ]* r. c+ c5 J  R
var iedom=document.all||document.getElementById4 V/ d" l% Q$ N' t8 y) u% G3 w
if (iedom)
- \8 A: Q0 Y. T: C' }7 bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ g# n. q+ y, E  x! c  p9 Fvar actualwidth='') W% I$ L3 K: C9 C) \8 Z1 N+ L: _
var cross_marquee, ns_marquee$ q* g; @! s* M8 ?/ f8 k. X

, i/ q& Z1 i  d% q6 o5 |function populate(){1 [$ ?! P5 V  x7 q1 X
if (iedom){7 f% C5 P9 V+ E) \
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 o, L. S9 }4 [cross_marquee.style.left=marqueewidth+8
  i& `; C6 I1 \) z& icross_marquee.innerHTML=marqueecontent. b* p( ?% M8 z+ }. V
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! ^, s3 y& C8 v1 X2 A
}
0 S2 K  f5 b. O' r, t) Nelse if (document.layers){9 w( V0 p8 Q0 C8 Y9 n6 r
ns_marquee=document.ns_marquee.document.ns_marquee2
$ O: @# |/ V; _& ^4 q/ tns_marquee.left=marqueewidth+8
& T3 c' M: t9 G9 q2 v$ Yns_marquee.document.write(marqueecontent)
9 l% w3 E/ v2 |; Pns_marquee.document.close()$ K4 P( Z$ S$ a7 k/ W) A2 a2 H
actualwidth=ns_marquee.document.width0 `; k6 u1 G) \: e1 `
}5 H* m: T1 Q& n! v3 ^$ f
lefttime=setInterval("scrollmarquee()",20)
: q1 W7 F# K- d3 ^" ?: A}6 E* D* V( ]$ X: G6 ]9 ?5 C! [3 p' F# O% b
window.onload=populate
8 o+ q  }/ I' _. [" A% _# M. c
- }& o+ i6 d. S  u5 R) bfunction scrollmarquee(){' l6 B7 H3 }/ ]. c1 Y' `! s
if (iedom){
% K. d3 s# O1 M3 }if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 S0 z3 Z" e0 c2 g. l" Q9 c3 e
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ i+ L/ W$ z8 welse
4 I$ S+ f! y- K3 [4 f' L1 Ycross_marquee.style.left=marqueewidth+84 a, x% F  E/ v) \: }( t

! _8 v( O  i* ^! V+ Y}: j* K( o/ e) D4 K8 H
else if (document.layers){
8 R2 o" |5 I$ l: \if (ns_marquee.left>(actualwidth*(-1)+8))$ X! \; n! S% H; Z0 x2 p2 r: X1 @
ns_marquee.left-=copyspeed
; w3 f7 M* D% c; v; Delse
6 Z6 W' O/ }# u/ \( ^- y. T0 ]5 k. Pns_marquee.left=marqueewidth+8: C; P, o/ y* s" x7 z$ b
}
9 t+ E8 M9 h% T" E* ?5 [}
* ]! ?2 a0 X2 r) Q  i% C
  X1 t# h# U; `, uif (iedom||document.layers){: [/ p. H- f# ~! }
with (document){
$ m! v! \+ J5 Zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- A* V5 H7 [0 K! q1 g
if (iedom){
# K3 {) [+ Q5 {/ l8 d" Ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 `* X& P2 @% x5 C* P+ Mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) r1 c( r7 O$ p( l$ K
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: h4 }5 P8 E1 j3 p, iwrite('</div>')
# P5 j& N0 O* T}
5 q: d1 W0 {% V' f- @2 k- O1 Jelse if (document.layers){
* D; S& b4 `0 jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% t; u0 J, N+ ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
9 J& z3 m; m' u0 Iwrite('</ilayer>')
! v/ R0 Q& p* g4 m( J}
6 [! l3 b" k, d( N6 Y% n! c' b0 Gdocument.write('</td></table>')1 y- {2 J1 d/ i9 G+ w* X# {( a" y
}4 |8 L$ r. c1 {, F. M
}8 [4 }4 \2 k) V
</script>

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