|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度/ @+ T/ d" A% V% _
var marqueewidth=300' E8 B; K- l# X# h
//高度
1 n+ @1 ^4 x% V9 E( `- xvar marqueeheight=25
! s# S0 [' @1 L |. E7 ?. s//速度(1-10)
: }; | G, p3 w$ Q! y" Rvar marqueespeed=3, i. e1 @$ I/ u3 ]! ?7 h
//背景颜色 ]2 C- A# ~1 t1 a5 e
var marqueebgcolor="#FFFFFF"
) U- a6 F' _* t& e9 r" T//是否能暂停 (0=no. 1=yes)?% |) }4 v5 u1 r: _; \# Y
var pauseit=1
1 o; A; t2 i1 R+ o* S3 g9 m! m' z# p. e' h& a9 V' _
//修改显示内容
8 |6 i9 s, d( b5 k! j1 y# P: ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ M- `" A6 d* ?
7 o6 G# h$ C6 A3 m/ |$ I& z
% A$ s, Q$ x0 p {% v: _////下面不需改变////////////. @/ @- e& p; O: L5 v, ?3 a4 q$ v1 t
# O+ O5 H2 P: o
var copyspeed=marqueespeed
$ K( d/ _! {: {' Dvar pausespeed=(pauseit==0)? copyspeed: 0
9 p8 Z1 k3 O5 H% e5 fvar iedom=document.all||document.getElementById, i1 T* C1 h$ R- Y, i% ` J' K
if (iedom)
; G* f+ l0 s) S2 S; pdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% g0 V, Z6 v" ^2 P1 X* Nvar actualwidth=''
; [1 y, p2 K$ _9 u$ X* vvar cross_marquee, ns_marquee
+ |. h' F7 S( }$ ?# x" t5 u
1 ]9 \0 z8 g$ u8 X$ ]( Y, Pfunction populate(){: D2 V7 n; [7 s6 B" Y# i% C$ x
if (iedom){; ?7 r' w5 Z; e3 U6 z/ }! R
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 R5 q5 {& O$ h% p. H' n2 Q
cross_marquee.style.left=marqueewidth+8
" U5 i+ v: \9 C# b0 `$ ncross_marquee.innerHTML=marqueecontent, [; t0 {& c/ K% S# x) ?) O
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 z' V4 u0 i j. N9 |: W5 @}
# W* ?4 A7 s) J Eelse if (document.layers){# m5 z4 y; {( T$ G
ns_marquee=document.ns_marquee.document.ns_marquee2
4 i! R, ?% v+ C- Jns_marquee.left=marqueewidth+8. c# p% n6 L: e: O1 K% q7 U
ns_marquee.document.write(marqueecontent)
7 g# N% q! J$ k( e3 Jns_marquee.document.close()
- f2 H- a# V5 a! ?8 nactualwidth=ns_marquee.document.width- o# `9 T" _: C# M2 ^
}
% g3 }2 ]% m) wlefttime=setInterval("scrollmarquee()",20)# n: A0 r! ~: i. n
}
" a" r3 u7 j6 N7 p! n, mwindow.onload=populate
$ j+ i" Z: X( v8 R% P: V" e+ y9 B. e# X: Q% E
function scrollmarquee(){' X+ B4 U# ?' y( K( O3 A
if (iedom){! [( J. }# d. f3 _
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 V8 r. b" |6 i4 I0 i' r# Hcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 q; g5 _ A+ b) F, [else1 ^. x7 T1 x" X% k9 i- O2 V! C
cross_marquee.style.left=marqueewidth+87 K H3 w0 x1 J5 ?0 W( m
. V( L, d( |7 K/ l$ y+ w}
$ A. S/ ?) T" g" ^& X- F7 Q% n Qelse if (document.layers){* R2 E0 F3 U% i0 l
if (ns_marquee.left>(actualwidth*(-1)+8))
1 R: z8 a4 c% a# Sns_marquee.left-=copyspeed* ^' ~4 m: T! x2 H: h- M1 h: X
else3 f- r3 ^; e4 {4 X
ns_marquee.left=marqueewidth+8- {) h0 Y' Y E" E
}! [0 `) s6 J1 m5 Q- P1 G
}4 J( j4 A7 `0 L! o; P e( {8 E
/ x# \* R# \8 j) v: d- J
if (iedom||document.layers){
9 B- w2 R L5 ]; S- Awith (document){
4 H1 O, O4 U5 @8 a& Q1 Kdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
' O9 y/ Z% I$ w; u4 [0 N: n4 ~1 c6 wif (iedom){/ [% j3 B& W `5 l! \1 M) X! }
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" P1 O1 |- r4 F/ y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& O1 a4 H' Y6 Bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& O. P" K1 `$ |
write('</div>')
/ U& a% }0 K# e/ G1 I}
8 [' a# f* u6 ~7 J" J$ Melse if (document.layers){1 Z+ y, L4 g) e- a4 g
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 q+ Y& c0 ~/ R H j
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* ~& [. P( n8 u9 W. ?write('</ilayer>') E! Q& V7 K8 C) T/ W/ a- W, x
}
0 k1 h: V' x+ N$ _) Ldocument.write('</td></table>')+ N+ [& p: f6 ~: I6 A1 l {$ u) s! E
}
- N1 F2 m1 D1 i}
! b+ O8 _6 l1 \+ C% R, r</script> |
|