返回列表 发帖

网页之跑马灯文字特效

//修改宽度; o% q2 s$ S6 _- j- a
var marqueewidth=300. [6 {. k$ W/ @/ n; h5 Z9 g) R
//高度6 c1 v, D* p$ {4 U* r" m1 B# d* Q
var marqueeheight=25
% H; ~8 S' y2 W  N5 G% k6 n//速度(1-10)) I& n, q- h1 G" l& n4 f2 }" h" i
var marqueespeed=34 d5 `, t! K( v* y" ?
//背景颜色
, I) L! }$ |8 H/ x: L4 |8 q$ Cvar marqueebgcolor="#FFFFFF"
) [$ L5 v! v; L4 \$ x//是否能暂停 (0=no. 1=yes)?
9 V% z7 }# ?6 g! N" x; {3 n/ svar pauseit=1+ I$ {  }; S  A1 N+ Y9 u

$ h8 R( G! n6 c( Z5 R% n" Y//修改显示内容
* N: z6 |1 q; q" Nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' n2 {% q" s; D8 [2 E" V* {2 }: _1 l* Z- d8 n
) L+ X" N, Q# M# k$ q( v7 ?# g
////下面不需改变////////////
8 ~5 z: m3 n1 F' C) A. L" S
$ Z6 V4 n# S9 Tvar copyspeed=marqueespeed
* m/ h5 x3 Q3 g! r7 {+ j) h/ Avar pausespeed=(pauseit==0)? copyspeed: 0. T1 T8 N2 |- s6 F
var iedom=document.all||document.getElementById% m- Q3 ], p$ {* V, m
if (iedom)+ ^2 B; W5 M* E# S% q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ P$ E. e/ c5 U) m: h6 rvar actualwidth=''* K9 g6 p( V0 \7 n
var cross_marquee, ns_marquee- I( c* G) b+ t" p( j% r

2 \" A  _4 w3 D" ~% e2 W, k: ?6 zfunction populate(){$ b" Z1 I# T" R) H$ J9 o
if (iedom){
$ d9 B$ |9 a1 mcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! c4 |' V* k0 e( ^/ Ycross_marquee.style.left=marqueewidth+8
+ Z& H/ j9 T% J: T1 i- i& Zcross_marquee.innerHTML=marqueecontent
  P0 F+ n' t5 I$ p* C5 _5 G& pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
' o3 {; k2 S( f3 i}
) ], X) q% N) E( M6 ?2 [. Welse if (document.layers){
% C" t# F1 b$ c/ _7 G4 @( Kns_marquee=document.ns_marquee.document.ns_marquee2
: h  V' ]4 W( H5 N9 T7 T1 @ns_marquee.left=marqueewidth+8
' k5 }$ P; I2 V; Gns_marquee.document.write(marqueecontent)
0 D( Y! x& _0 `7 U- V) e+ r6 [ns_marquee.document.close(), q# w# A- u. [/ S
actualwidth=ns_marquee.document.width
- D$ W! Y& T  K. R4 G8 Y}
8 \) l2 P, j6 H8 Qlefttime=setInterval("scrollmarquee()",20)
( c5 E  q# X( _& u}
3 M0 a; |, }" O  Awindow.onload=populate
4 i7 }5 J6 I4 |% t. F3 R4 B6 g% W
function scrollmarquee(){; q7 A9 C) o6 M
if (iedom){2 ]' l; L3 _) w6 B2 A( A
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 a5 B3 k- e/ W9 v9 Qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 R0 H2 _& g2 f1 I  ielse% I0 A  Q' M/ O* L
cross_marquee.style.left=marqueewidth+88 l' ]: W+ W0 }
0 `1 `. I; d/ g5 B! h6 L& V, ?5 D2 h
}
3 B+ \& ~; p# U' |! ]else if (document.layers){
" I4 ^2 v" a0 Z$ A# Bif (ns_marquee.left>(actualwidth*(-1)+8))
9 i8 A* z# O4 s2 Y+ Q3 Sns_marquee.left-=copyspeed
" l; W( u2 a( i5 Y4 j  ^+ k4 Ielse5 @; a, k8 C* _+ g7 b! x
ns_marquee.left=marqueewidth+8
: q% K' W7 f$ A' ?7 Z' w}- n4 B- D0 x* z6 Y1 Y/ _4 v4 s
}0 S. R5 ^) x$ b  {( P$ d7 \
) ], M0 E. U6 W# ~$ D* L* h% ]
if (iedom||document.layers){
+ p  N  g* a) m* X/ y  f" Xwith (document){) o+ e  G) ^% F# Q
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" z9 N2 [9 D5 T6 R$ Nif (iedom){9 Y5 r; Q4 d% k: r  S6 x2 y3 {- B7 G
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- U" ?3 W6 d! v
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 b' m+ J5 H  C- j3 w' j
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: d3 Y% o% x  E/ V2 z; f9 @write('</div>'), ?* J, M  e: \$ Y0 x6 H
}
: X4 A4 ?6 Q, e, s8 jelse if (document.layers){2 {' s! r; Y1 h+ x
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): o% A9 J3 R0 t& V3 e+ B, n4 |
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 B& p6 |! Q# @1 D; u& G: y% B5 v
write('</ilayer>')
! Z: r) V$ }, V- ~2 N0 j; H" T}
  E; \& L' h2 ^; C& C2 I* i/ \- cdocument.write('</td></table>')
9 H# L0 o; Q7 i$ t) n}
7 k' b5 B% ]6 [/ q" t2 v}) {  i& b! B$ N( d
</script>

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