返回列表 发帖

网页之跑马灯文字特效

//修改宽度* f4 A& G6 m+ M) }7 W! p7 p
var marqueewidth=300% s/ e6 L  A7 V2 v& O& y% X
//高度3 A8 q, u; O8 t+ R! X2 {
var marqueeheight=257 W/ I6 S+ G+ W8 n' W9 A9 Y. ~
//速度(1-10)
% @$ \) ?- H$ b/ u  vvar marqueespeed=3' Y! b1 M; X9 ^( i: N7 j( z
//背景颜色
$ P. ^& K- E8 ^( a8 o" Mvar marqueebgcolor="#FFFFFF"
6 z$ \( R9 I6 k- M//是否能暂停 (0=no. 1=yes)?
) M5 H- I1 Q7 V. R' hvar pauseit=1
$ {2 G% a; _, I$ k0 x7 e
1 V% b; p3 [8 x' y, T% Z4 p//修改显示内容
, P: ^6 k8 e: m! z/ |( gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% C; a- u$ Y  W  R" q: |, J' n
( l+ ~- R" _. ]1 m

: `: X. C7 f$ q( C! D. T. I  H  G) b////下面不需改变////////////+ z2 F. g* n  ]/ c
8 n: B/ l4 \8 [& Z9 p
var copyspeed=marqueespeed: @/ f( r9 b. B- }4 I
var pausespeed=(pauseit==0)? copyspeed: 0
7 m; \6 s* i! v# r# o! [/ g6 ~var iedom=document.all||document.getElementById
0 _( c7 U, M. w1 Y, lif (iedom)2 O5 n* @& U8 H0 f
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 X  i  ~% Y' ~( \4 i4 mvar actualwidth=''$ P" Y! @2 B! @: J& m, q# ?
var cross_marquee, ns_marquee
. V& `3 |4 w% v* ~' _& g, C5 H! n$ a9 h* c
function populate(){
0 O; w2 G! G) \9 k9 |+ Kif (iedom){
, B3 k& s, |+ V/ w' Pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: E' L: j$ P0 q8 z& U$ Fcross_marquee.style.left=marqueewidth+8: D$ V3 B+ u8 v$ s' w
cross_marquee.innerHTML=marqueecontent
9 a' \1 U& ~: w( mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. H. l6 s& b- Q: P7 Q
}
$ h0 ]+ j& @1 _. ?/ felse if (document.layers){7 j7 K; ~& Y+ \8 Q" w' a
ns_marquee=document.ns_marquee.document.ns_marquee2
- Z) |5 L5 v4 g2 M# J0 Bns_marquee.left=marqueewidth+86 t  u; \) o2 h7 o+ }
ns_marquee.document.write(marqueecontent)8 s2 b0 q7 v. B3 a( e
ns_marquee.document.close()/ l# r' f! t" l+ F) T8 g  O
actualwidth=ns_marquee.document.width$ P* _* g% s  d* c
}
  W$ h# [0 c) L9 m/ F' d/ Mlefttime=setInterval("scrollmarquee()",20)
. Y8 s' ~% A8 ^0 u' b+ c  |}
8 N; M) u1 [% z6 E! D) e# Z) gwindow.onload=populate0 ?4 y8 I' J% Z! [5 |; s
  n6 F: {( z' J3 T6 R! G* I/ O
function scrollmarquee(){, u% j$ V% c+ Z
if (iedom){2 O8 K% b$ d9 J0 y; \+ b
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 S- S5 x  `) `6 i
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed7 ]2 a6 J0 L6 v7 b; b0 W
else
. b1 R* k( J. }( o( C/ B  W3 _% z5 gcross_marquee.style.left=marqueewidth+8/ c, R* Y* l  r8 L3 k1 q
5 Q8 a* k  j7 e1 l1 s
}* ^+ d, c( b; e2 J+ ~! [
else if (document.layers){4 D% N, ~3 V  M- a# A. {9 R
if (ns_marquee.left>(actualwidth*(-1)+8))
4 B2 O1 t+ k8 t- S* j) @7 Nns_marquee.left-=copyspeed  n% L4 n2 D6 p# Q6 e5 ^2 b
else
. q0 C& L7 J) [9 F+ w- X5 {% Bns_marquee.left=marqueewidth+8
: @; x% c3 v' Q9 v; a, F' t& K. E}6 B2 d0 |# l+ Z
}
) s9 X+ |7 o# a/ S/ I! o& N2 h* }8 {5 }: [0 r$ }( ^( R4 h
if (iedom||document.layers){* q1 C$ w$ \2 j8 u: v6 ~! s
with (document){. \/ q' E3 @" u& Z8 X: {: J0 |
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) R$ F" E# G: v5 T
if (iedom){* o: r$ o' ]& L
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ B6 i! n" e. L8 ^- p$ [. Owrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% _- |. o  j* L
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); k/ W: B6 c" T! }4 |! z) D0 y
write('</div>')
- W6 ^* C* w4 L7 r}/ v3 M( f0 J" N& H: J1 G
else if (document.layers){
+ {8 B' C2 B% M4 _( Jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; E) t$ _8 `) f+ k0 y8 i5 }+ lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! Q: t% ^5 j0 G( e% wwrite('</ilayer>'); I: t, `' U* @3 \. R9 r" S0 ?# ^
}  w3 z! D+ P% l' [5 c
document.write('</td></table>')$ T5 _* M6 |! _. \) E# F6 t5 B
}# ^% e+ u" u# O, e9 u
}
5 ~; N8 M7 p3 @. u$ k  Y6 X# r2 V</script>

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