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

|
网页之跑马灯文字特效
//修改宽度
+ j- v) k, p% \) d8 Q4 s5 K( ^var marqueewidth=300$ v; D# ^% r; ?+ A# X- y
//高度
0 g7 ]4 @6 H) d0 A8 Avar marqueeheight=25* [$ @ N/ K$ _1 L( Y9 |3 m7 Q
//速度(1-10)' [ H" |1 | V& o; F
var marqueespeed=3
4 z$ n( B5 Z4 E//背景颜色
1 s4 E( T; _7 I/ ]0 Z% Avar marqueebgcolor="#FFFFFF"6 f+ j# m: y3 I8 v2 c
//是否能暂停 (0=no. 1=yes)?
' v4 z7 i- b; i4 C6 K9 yvar pauseit=1& Y& H8 V$ c* ?, [( V
T" Q5 C6 G- }5 ~" D! Z//修改显示内容4 z0 o: Y* F# u8 F( `) d( ]
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. ~/ m8 A2 l! J+ V" d
+ w5 X6 h0 {) L; O, k
/ G" }' E9 f3 z* u1 c////下面不需改变////////////
& t1 ^; [! v) f! X+ x
' R' k! L( i$ ]6 u( I/ z) V; Kvar copyspeed=marqueespeed
% z" L( w1 w9 r9 G3 j% P( q( yvar pausespeed=(pauseit==0)? copyspeed: 0
4 c7 k, \, U( qvar iedom=document.all||document.getElementById
3 u) W6 @: i1 R4 o& e1 _if (iedom)+ z+ c4 Q8 i1 k. t: X
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" H1 { P4 y0 ^
var actualwidth=''
- a! p$ |- [; b+ G' m2 `) Uvar cross_marquee, ns_marquee$ S V$ D: I0 b% u
' A# X1 u% e$ G3 [, }% Y5 z% a2 Zfunction populate(){
* P' v: ?+ h {$ C7 K3 f' vif (iedom){
0 M( ^2 L, m5 u. C! A0 a5 ycross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 o8 f, R# \- b0 K, _
cross_marquee.style.left=marqueewidth+8& D+ \* X7 G0 D3 ~( V' x: e
cross_marquee.innerHTML=marqueecontent5 h. P2 r* Z% J* [. u
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. n2 z: Z1 f+ U( `8 j% M+ Q0 w0 {
}1 }: B: R/ W( v; x
else if (document.layers){- y" u e8 l+ I1 D
ns_marquee=document.ns_marquee.document.ns_marquee26 W' u) z2 e& A% B# `
ns_marquee.left=marqueewidth+8) J5 E4 l' Y- K" s: g' n
ns_marquee.document.write(marqueecontent)
E {% I" L* }. wns_marquee.document.close()
* m* V2 x* |4 }3 {6 f; B$ [actualwidth=ns_marquee.document.width/ B1 H) C" M$ q! z$ w. M& ]
}3 }. |5 ^5 H1 z2 e1 y) K5 n
lefttime=setInterval("scrollmarquee()",20)
* ~" |7 o0 q- R, ]$ A6 N}
) ]; E J) w; g2 y1 hwindow.onload=populate
0 y4 t- i* Q& A. i8 Q6 N/ f( _& F0 E- n( j
function scrollmarquee(){
: Y$ _* }3 C% ~2 T3 |. @! h& Y( F- d1 iif (iedom){, ?) I: k; M x6 h8 d6 C. I
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))- V2 s+ M. R/ L. y, p$ F6 A
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed0 R1 e# P! K5 p) P" j, r9 ^3 r
else" c$ }- t0 e: _
cross_marquee.style.left=marqueewidth+8
0 n& V. @: |4 C$ t- h9 V. A
; X& Y9 L7 G# {}
& E9 j8 T0 o" ^3 ^" E7 j# jelse if (document.layers){
) O& J3 E$ r5 B, u [, @if (ns_marquee.left>(actualwidth*(-1)+8))
1 u3 i& Z" Z% w! cns_marquee.left-=copyspeed
* t) [- H; n/ n" C' n; {else8 ?+ C2 ^# t9 \% s* U4 I
ns_marquee.left=marqueewidth+8% G2 Z! c1 [, W- I& I3 I/ w( R0 X
}
2 s& t) K. O# q}9 j& W* [( O& ]/ X0 N/ t: H3 A
9 V& _. A }/ T1 R& }if (iedom||document.layers){
- |; _5 N$ S$ d/ G" ywith (document){& c4 N4 ~/ p# q S' ]7 a
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). u8 G. L" M1 D9 M% G
if (iedom){
$ j: N, }" U! @write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" E' I( M' u# \& `write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& N- h8 R1 Z/ G0 A/ z* `* _% [2 q
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 r9 E2 \* L) m# ]6 a" j1 c
write('</div>'). t6 x5 C3 S7 s+ z* j* u
}- U" N! c9 t8 F% C* l) g0 o
else if (document.layers){
- e6 Y$ v" E/ [! X' u2 Swrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; u q- H: I# P) Kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. w) r7 L1 S1 i' z+ zwrite('</ilayer>')+ ~0 v* _$ h$ _- b1 u8 X6 m
}
; S: a; _. @& C) K4 _- I, [document.write('</td></table>')
8 O5 ^3 S5 g. g: {( m} {( ~ u8 B1 r" A2 E- `
}$ J% Y" A$ h8 [8 {- H' C
</script> |
|