返回列表 发帖

网页之跑马灯文字特效

//修改宽度
( V+ J) H  R& u; D" d, k9 u9 Pvar marqueewidth=300
/ Y% P; S" z! k//高度( f( H; M: q/ s6 E% J7 |, s, N7 f
var marqueeheight=25
5 J5 b3 P/ ]6 A- I% S4 _* V0 l6 f: H8 H//速度(1-10)
; Y8 [( ?8 q0 J; j2 fvar marqueespeed=3. i' C- k2 s0 u0 ?
//背景颜色
( C7 V* N# T' L. gvar marqueebgcolor="#FFFFFF"% R4 D1 @5 j4 w' \2 a2 w
//是否能暂停 (0=no. 1=yes)?0 \4 s" d) }& h& B2 f( `4 P+ ]
var pauseit=1
6 a* g- N$ x8 n. `
! \4 _3 t/ S$ e* g" ~//修改显示内容  K7 z- s$ n% s! D9 K
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
  q# w! T% ]* t% @, o8 M- A! M
$ B9 P  x# s7 a* g% X! ?, S* Y9 E: l* E. s. z
////下面不需改变////////////
  w- G: r. G5 l+ S0 v- t2 _2 y9 E! \9 \1 C* W, K
var copyspeed=marqueespeed
1 ]+ f+ |, a6 jvar pausespeed=(pauseit==0)? copyspeed: 0
* B3 K$ r; f# H, Yvar iedom=document.all||document.getElementById. B: Q) Q& c5 y% g$ P# \
if (iedom)
4 f6 F1 t- C- s6 m" h5 Q8 Odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, L: ~; W2 K0 _8 Pvar actualwidth=''5 A) n0 _7 d4 i% C! @" s
var cross_marquee, ns_marquee: P, f( n0 M4 W- o- ]1 `

% f+ L* ?0 b- V- G/ V6 x( Bfunction populate(){  r$ a5 c4 o; o, V0 P8 y9 ^( k; F" g
if (iedom){7 N- \% h+ y  z, y- l7 }+ c  ]
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* \' ]+ c1 W5 S4 S/ ccross_marquee.style.left=marqueewidth+8# l) P8 }9 {7 a7 h  P, j! [  N
cross_marquee.innerHTML=marqueecontent* ?. `4 ^& X  R* x
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) p! R7 h$ v5 L" O" U4 q}
8 Q& _( w+ k5 ?else if (document.layers){
! M7 |, ]. g& ]( m* A* T: H' kns_marquee=document.ns_marquee.document.ns_marquee2% `/ e) c0 i$ H# ~; u, h6 G
ns_marquee.left=marqueewidth+8; U7 W# R7 G$ q$ l$ q
ns_marquee.document.write(marqueecontent)0 m( @+ j; c1 w8 B; S9 [
ns_marquee.document.close(): }, o0 w7 n  j  h) X
actualwidth=ns_marquee.document.width% o, x0 _) P6 r; @4 g6 t
}, s2 j" U) [- c
lefttime=setInterval("scrollmarquee()",20)! j- m6 H7 ^$ Y6 H
}
# D' a' ~7 _5 P4 M5 Vwindow.onload=populate
9 X- Z1 l- n( p6 Y3 K# x- N2 {. F/ }, @5 s( |( I" o8 e
function scrollmarquee(){! s/ b, @, U1 ~7 U6 B* m/ P
if (iedom){
+ b/ Q$ l$ A0 q8 K5 }$ [if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))9 L# M7 u+ g+ m. V5 O" m
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
- I# @, {2 @+ u6 Yelse* T8 {& {! W5 I9 O: f& U7 f* l5 T
cross_marquee.style.left=marqueewidth+8
1 U; _. e. L* e) _" f# x3 R3 N( B# @7 V% {( Y3 e2 k+ j2 G3 [
}
8 g( `7 _; L6 celse if (document.layers){
5 I$ L4 E( K! m( |if (ns_marquee.left>(actualwidth*(-1)+8))* G7 u1 p/ f1 G" i
ns_marquee.left-=copyspeed6 `; B* [. ]3 G
else/ Y+ @( K% I( k2 ^3 P
ns_marquee.left=marqueewidth+8
  x+ W( ^& M. p+ Y; M7 R$ V) W$ \}
, X" K! k, Z0 |6 o" \2 W* e}
9 t- x* r' t) n
1 `3 z6 t* D7 G- J- ~5 b2 @& tif (iedom||document.layers){, r+ J0 q8 y& A5 N
with (document){
: C0 d0 }; p- G' |, h, Bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 `2 I! J) Z1 M, p' x6 j8 C) G) Q
if (iedom){- u/ M/ C# t9 r. F' w' V
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): `7 {3 d' @7 c9 K( x& `0 z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
0 {3 m3 Y# o( u* O% b; U/ Y8 r- nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 I9 H2 K+ C! D: o; f9 A$ w
write('</div>')
  _* C% q% Q6 S& T& k+ j4 i}# F& t9 n9 d# G# O
else if (document.layers){2 d; k" f( H- F
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! V6 a" x. i$ L1 ^& v7 D% x* fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% T* u# B) U1 e5 P% x. V
write('</ilayer>')  K! B  L+ t6 i$ d( \
}: D4 N/ f1 d$ J$ f8 r1 Y
document.write('</td></table>')
) ?4 F$ N/ T1 r}
. C2 U" K4 n5 B  U& b}
5 d0 z$ @2 Y% U& b; s</script>

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