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

|
网页之跑马灯文字特效
//修改宽度
# R. i6 e1 {" z/ z4 j5 u3 Cvar marqueewidth=300! D& h- C5 ?! `+ u, d& v4 A( }
//高度
2 i$ s7 T* k- u3 k/ o. ?& z1 [7 bvar marqueeheight=25
/ b/ w+ {; X% y- v5 w4 f//速度(1-10)
8 R8 g$ \4 [$ ^7 \# O: rvar marqueespeed=35 h# c' p" \4 ]/ Z& `. A) \) I4 n; C
//背景颜色
4 L' A: W; Z# m: l g3 Y E& Nvar marqueebgcolor="#FFFFFF"
/ o: B! c9 ?1 l( D0 q. i1 w//是否能暂停 (0=no. 1=yes)?
6 I# V, ^' m) @: i% {var pauseit=1- F6 x1 ^3 d; `
4 @* D4 x/ p; G//修改显示内容
5 m. O- ? [7 M1 W- yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& y1 f( x% j& D, ]. X" q5 p( H4 V, d
7 {+ f4 V3 o$ V4 T. h! A
" g; }* W, a( B0 n6 }( \////下面不需改变////////////* H1 Y& {# E7 j
4 q% [# ?" O. J# ~. A8 }/ r
var copyspeed=marqueespeed
! N' a+ W2 A& t8 `) K: V3 \var pausespeed=(pauseit==0)? copyspeed: 0
* J" H# x7 v8 ]var iedom=document.all||document.getElementById
; i: Y! X# D, L' vif (iedom)% k' N) E I( T( B
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 I4 ?4 H0 Y8 D& x" T( s& V* ]8 e' Wvar actualwidth='', H* M; Z8 ]! T' y7 h$ b& J/ s! S
var cross_marquee, ns_marquee+ |4 B) W% i; I; u( e8 f+ ]" h6 d6 D
; n4 {2 Z0 G6 g' { X) D) mfunction populate(){6 \( D' c* |" p, l8 e/ d3 J
if (iedom){
& n: H; c- [! Y) ycross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# |; R/ `! f/ k$ Rcross_marquee.style.left=marqueewidth+8
" E' k+ d5 s% m; rcross_marquee.innerHTML=marqueecontent n# h& ~' u( g( D: J F
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 Z4 q7 w2 h B! Y/ ?$ X' F' c}6 {) k1 X. t4 b/ ~# b' A( d
else if (document.layers){, S! c5 c* i8 M# D
ns_marquee=document.ns_marquee.document.ns_marquee2, i( n2 ?) N5 S. |
ns_marquee.left=marqueewidth+8
& l w. K7 Y9 G: A4 Bns_marquee.document.write(marqueecontent)
# }0 S: d R+ S# P6 `9 a; ?$ ^8 M/ wns_marquee.document.close()
6 M* J A( G5 I: z( oactualwidth=ns_marquee.document.width
! I1 [" w+ o- b) x9 h. F( j}3 ~) [, {7 [& l2 R1 J1 h1 j2 q; `5 O
lefttime=setInterval("scrollmarquee()",20)8 C- S$ P* L; w' {% m0 `5 a# Z9 ]
}& ` K* f- U" \4 a- P
window.onload=populate
4 l/ X7 ^) L2 c3 ^4 l0 F" T
6 c j$ r4 c% ^7 @# a" |$ X& efunction scrollmarquee(){
" X+ Q0 q0 B h6 j4 t Jif (iedom){6 V7 ^6 M2 Y( U$ g. t F7 p3 ]
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- `7 y& S0 r2 |0 \7 n; h0 Y5 A" dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' z5 n3 p* c; ^/ r4 qelse' t, I7 j4 S' I
cross_marquee.style.left=marqueewidth+8 Z; i7 M6 U0 h* ]
( v2 n8 `( d2 i- r9 e# a
}( `) L* o1 A9 ~1 V) s5 L8 U
else if (document.layers){
# F6 @$ |3 V. q/ B3 ?if (ns_marquee.left>(actualwidth*(-1)+8))
: \2 U+ ^9 T1 Y5 @0 Pns_marquee.left-=copyspeed4 p! @0 Q. z4 ^' D! _" p$ j, j
else! l/ M1 H- p4 J) R
ns_marquee.left=marqueewidth+8
+ M, j: n5 d. A# t# A( k}
: C4 Z: B4 e! J}% p1 a9 M- E2 [0 B9 q
/ a- \$ M9 g3 B5 Q/ G( Zif (iedom||document.layers){% b' V* I B! n* W# N2 Z) O
with (document){
8 u) ~+ C/ r5 r V! Vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 `$ t5 ~: P7 O3 K! yif (iedom){
0 `" o! @1 U% u% ^, Q2 u5 i3 Dwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 q( l0 t$ C1 f1 a8 ^; }write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& S2 c# E1 B- D2 j8 \1 L6 ?! n
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& k; F; m' M0 Q( Cwrite('</div>')
1 B4 I6 j7 Y: Z4 Q5 ]' i4 u5 y}) c* n6 F! g7 m, c
else if (document.layers){5 w7 h$ C9 W& V7 T9 k A( Y$ }
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" ]9 T% e* `6 ?& {$ H4 c4 ]8 ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); X! D& }4 l3 I! J7 d$ q2 O/ S/ l
write('</ilayer>')
( q- G( X5 b- M/ w}& D- E: [0 P0 c z! O u7 G' |
document.write('</td></table>')
% P3 b, v- s& y' ~& j& t+ r}
3 O/ ^* h) u: @6 ^6 S: V}+ h: Q5 m x( D" b/ |
</script> |
|