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

|
网页之跑马灯文字特效
//修改宽度* v1 H: D! J6 x1 ]
var marqueewidth=300: C: d; z% p5 i D8 h; m' c9 y
//高度" U& ^; f7 J1 Y* P1 r6 p) ~
var marqueeheight=25
* C2 x/ D# E, L# L6 w! |//速度(1-10)5 R& j7 @0 P# P; R( R
var marqueespeed=3' h6 v% Y& ?$ f5 F
//背景颜色- ]' z+ T8 D5 @0 k$ V! f/ K* _3 E
var marqueebgcolor="#FFFFFF"
9 N) G! V$ G% |$ T2 t0 O//是否能暂停 (0=no. 1=yes)?3 f( G ]3 F; F, Q
var pauseit=1
. O5 ]: a+ Y: L& M6 y; t" e% i; r: O2 B) @$ Q/ A
//修改显示内容
" p) ~0 z" |$ l9 _* xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 q" l* g8 l0 y9 E& F2 _, G& B
7 |$ u& y: e( Y/ J) Z
# R$ g, U; [/ j
////下面不需改变////////////& Z1 u) L( o) V
1 w, ?0 E7 i( T; N8 ]var copyspeed=marqueespeed
3 Y' E! C# g& _/ d- \var pausespeed=(pauseit==0)? copyspeed: 0
0 f- n/ Z' n( v# avar iedom=document.all||document.getElementById
- w* U7 ~+ w4 t; F7 @ h4 x8 o; O `if (iedom)/ b2 t3 x+ P6 w/ j: `* ~
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 U- ~0 B: G* M; u5 N& ivar actualwidth=''+ i- X6 h$ k6 Z% [
var cross_marquee, ns_marquee
) y. x/ O' D; m% W9 }4 m% R. I* ~4 K/ R) P# P1 U3 H* R9 G$ z5 X; G
function populate(){9 y# y1 t, Z9 T& N. R
if (iedom){+ Q5 r7 `6 S8 D
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- f% ?0 B" @) l8 r5 M' Mcross_marquee.style.left=marqueewidth+8% i! \& j* M0 `+ O+ e5 H _
cross_marquee.innerHTML=marqueecontent
$ x$ f6 G# g; @% B' y1 \: Gactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- H& i {: |0 o; [5 h) r
}: t& i3 P1 J, |( F2 ]
else if (document.layers){* ^: D! D( f& D ]
ns_marquee=document.ns_marquee.document.ns_marquee2
/ a6 i% O0 c/ F, Ans_marquee.left=marqueewidth+8, t ^) c. Y- e1 \! b6 }
ns_marquee.document.write(marqueecontent)+ I% A) r8 h% ~( }0 n# w
ns_marquee.document.close()
! C$ E$ j6 M8 y7 P8 Q4 @9 Zactualwidth=ns_marquee.document.width9 K. J; _( O- e! I, L
}
- a7 Y9 i6 v* h) G* ?/ m1 a% `lefttime=setInterval("scrollmarquee()",20)& ~. B1 A4 P1 Y I3 t
}1 s7 c: C A9 m* a7 [
window.onload=populate1 Y! F. f! G" F" }; y* _
9 M1 I7 d" x$ E/ u. ], Q) c& N, b
function scrollmarquee(){
( w& z% {, J3 t! D$ e. Jif (iedom){% E5 M* V5 E7 S& _5 h8 n1 j9 v7 K& u
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))9 }/ a# v8 @4 l4 `
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 O1 C! V2 k3 T. d. relse. Z/ _* M% l& X
cross_marquee.style.left=marqueewidth+8$ j* R0 M s ^( |
. [6 V( Q4 K: j$ a& U8 z. |. n: n
}7 _7 y4 m' K8 K. k# ?8 H/ D( i
else if (document.layers){; m. D0 c, O* Y4 L3 }- f
if (ns_marquee.left>(actualwidth*(-1)+8))
& J R e9 [" k8 }; D, L; ^: h3 C/ Gns_marquee.left-=copyspeed4 b. w. u) i2 \6 D
else
4 a9 h4 R( M. y+ ^ns_marquee.left=marqueewidth+80 }) j! ]- R8 h& c2 i
}* p- c1 R) v) Z% R
}
9 a0 ?* Z7 m+ F! w* ?" w$ k$ E+ i! Z5 b' ^, m/ t! @2 f% @
if (iedom||document.layers){& c% d5 h" `1 I4 _; a6 P
with (document){
5 V9 v5 K- d+ ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- Y$ C! i# R- V8 H" h' n* T
if (iedom){
6 u* A, N/ ~7 {& n% \+ l6 s* k& f9 ?write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( `% w0 D% M' H- m( D: u% X
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 {& |8 t3 `4 L5 R7 N( ]
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>') p8 O( |( O e
write('</div>')
- B- F! g6 L5 X" y, n' M# e/ p3 y}
0 f; t% X# y1 w5 K; ^else if (document.layers){- w: K- R3 X0 O( t
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" y7 j+ P& @' n3 @) U1 \
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>') @6 t; o4 h( q+ o5 A* G
write('</ilayer>')
+ h* D/ S8 o2 `* f# o7 T1 \}! S) U5 d5 l/ w# @$ {; z$ C
document.write('</td></table>')
h' h$ e3 q9 s6 S7 K8 f% S; Z; v l}
0 O* }/ W0 L3 e( Z+ W}
- ], G- n$ _: z& k F9 A. h+ W</script> |
|