返回列表 发帖

网页之跑马灯文字特效

//修改宽度
) ], {' z* u  _6 e" Y% c6 Lvar marqueewidth=3009 c$ d3 E+ C3 z4 {% R
//高度, V$ U$ L) o& l
var marqueeheight=25
4 ?% p% e' d3 _# M, e//速度(1-10)# t" b9 R, ?! p
var marqueespeed=3
: a2 r0 `& i2 R! G/ W//背景颜色8 i' U* D0 E3 N% A7 `9 J
var marqueebgcolor="#FFFFFF"
$ m: Q! X, F5 R$ o" H4 U, e, U7 u) y//是否能暂停 (0=no. 1=yes)?9 z6 @* K, R& o
var pauseit=1+ u# E: C8 b& j7 s
  {1 Z' z; r0 N, m0 Q  O8 ~
//修改显示内容5 R# ^, L$ P5 {# I
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ ~: f6 C" Q) n+ O: h- w
. t: ~( g/ \9 u4 U, ~: _; ~; y
! B3 ?0 z3 \4 Z( o) Z////下面不需改变////////////
5 T2 L. H; h- R
& O; I4 e9 p: Dvar copyspeed=marqueespeed2 `2 L7 z9 q9 A4 w2 T" n( F
var pausespeed=(pauseit==0)? copyspeed: 0/ R: p- K, B. V7 j
var iedom=document.all||document.getElementById+ S+ b0 G3 [6 V% H# e
if (iedom)
9 X7 t7 K6 E% |) S0 Qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). k, ]3 E: Z5 L$ b
var actualwidth=''
8 q' a6 x- h" `2 u+ l0 Wvar cross_marquee, ns_marquee$ p. ^0 z. _, B! [3 l  l9 W  m  z

, w" J/ S8 A% Hfunction populate(){
8 y& j- I7 v! l5 }& F  nif (iedom){0 ^+ K+ o3 l0 L
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; i" Y' y3 d6 g9 e' b' U1 r' Ycross_marquee.style.left=marqueewidth+8+ O) r# I" \2 z. S& O
cross_marquee.innerHTML=marqueecontent2 i# R+ Z# F- [# ^$ ~2 Z: B. I
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
! V& P) n4 r6 K5 w}
  o9 G" [) b4 C* v$ [* o2 gelse if (document.layers){
& m: ]) [5 `* V% z: ]& xns_marquee=document.ns_marquee.document.ns_marquee29 B+ }1 V0 S( @1 B" @" N& m3 ?
ns_marquee.left=marqueewidth+8! B2 i' A+ k0 _7 j
ns_marquee.document.write(marqueecontent)
/ v' i( l, c; gns_marquee.document.close(): S4 j" N2 G! V; @
actualwidth=ns_marquee.document.width
+ p" e# E% g/ l" i' F, k; E8 {$ @}2 o$ `* x9 Q6 P& R* S+ o- z% l
lefttime=setInterval("scrollmarquee()",20)
# e4 v6 H! b7 C7 H# c* }}
2 z) \$ p# f+ g* c/ U; ]window.onload=populate. x$ ?. @* l6 s* q4 q# N

+ a3 z1 |% C7 _0 o2 hfunction scrollmarquee(){) ?, k' ?# E& K0 z. O/ p
if (iedom){# Q6 Z& M# _& x7 V3 {" i- }4 }+ u
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ @9 L0 l5 j- r( l$ I
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 _* D* A- X6 @
else# P, Z3 l7 f0 N9 l, I. I' I! l6 l! i
cross_marquee.style.left=marqueewidth+8
$ w  k, ^/ V2 H3 ?7 `9 n; |7 z; R( j
}" ^6 ~# {7 A% z9 I- R. u& S
else if (document.layers){) D% l4 A1 e+ S' E# P
if (ns_marquee.left>(actualwidth*(-1)+8))9 @; |7 e& u0 ]5 F
ns_marquee.left-=copyspeed5 E/ r% N3 J2 Q) K$ t! H* D/ I) r. ?* b
else  A% R, B0 S6 d+ b, K; g
ns_marquee.left=marqueewidth+8
4 @' g* a) F) P, [" L* N( P- o}
6 ^8 ]( ]/ h# n# a}
. e" w0 p% \2 t1 j5 K% @) n+ w) e2 j0 m! o/ S* O
if (iedom||document.layers){9 }" j( f$ q. I& `
with (document){7 p# F, C2 u8 R% h: K5 ^
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- [8 L3 ?8 M8 X1 Jif (iedom){
& |+ C0 t, i+ |* `6 qwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). V, m- Q8 e# |1 d
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# O6 V( y9 |2 pwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 n5 L* Z$ X( z* O% g# ?! ?' `write('</div>')2 p  Q% o$ T, H8 Z9 W4 M6 o- e
}
( H: P% a) i' {. Z- E4 q8 t( Belse if (document.layers){1 D  F! L+ N4 n- x! P
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 p4 W/ d7 \3 c$ N6 Q
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 h/ c2 u: z0 u: i. |0 G% g! Iwrite('</ilayer>')
3 Z$ e2 k+ G5 G}
4 b; f( g. R; A: J+ N: }& vdocument.write('</td></table>'). L( M2 P4 O/ ?' o0 V
}5 Z/ }( a6 C0 F9 l
}* b7 x6 C9 ]3 t% c
</script>

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