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

|
网页之跑马灯文字特效
//修改宽度
+ k/ I4 |5 x% t7 B( evar marqueewidth=3006 i( L9 U8 k; X9 V3 q o
//高度
8 e V8 E' {4 V' \/ svar marqueeheight=256 h9 G/ n: r" a8 K; x7 J# h* ?
//速度(1-10)& z$ s' f5 @0 C/ C( X- O0 j. x2 R( [
var marqueespeed=3 _8 ^8 a( i( ]) o. T7 C7 x
//背景颜色
# f: c' M; R, V, e$ b R2 p; Yvar marqueebgcolor="#FFFFFF"" ^# I( |9 I) e5 J- y4 O( t
//是否能暂停 (0=no. 1=yes)?0 l8 y& Q9 {/ [5 O% k4 I
var pauseit=1
& \+ i& I# i7 T4 Y8 H6 A9 h
1 X Z, g+ C; I: B//修改显示内容
5 c/ h2 V) V& H5 Rvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
4 b$ N! g" X6 k* q" j: L7 }* ^7 n
0 i& @$ m9 p5 a& |7 Y1 Z+ o: H; U" c2 }6 K/ D
////下面不需改变////////////% _' s9 R2 j' t
9 ^6 Z _( Y. s9 r
var copyspeed=marqueespeed
) J4 A1 I9 {) C9 r# e5 Y3 R7 H1 Kvar pausespeed=(pauseit==0)? copyspeed: 0
: ]3 H; u) B; Q) E0 X6 p yvar iedom=document.all||document.getElementById
. d' ~; d( u; y4 Uif (iedom)
& H+ S( W9 Z) {& y4 G: Edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
2 e' H _& V/ ~" C) n" q' Zvar actualwidth=''2 U) K# N, K- L( S% h& |( P
var cross_marquee, ns_marquee
) J ]; n( W* i3 b$ q7 x, s" I5 O; @# E" [
function populate(){; b) m% Z3 F' ]" f8 j' Z
if (iedom){; @% D% e. j5 M$ R1 H
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& |7 U5 o& i% A) hcross_marquee.style.left=marqueewidth+8
) h) N- U& D* U$ i2 B1 ?- B; p9 xcross_marquee.innerHTML=marqueecontent
" K" P, m; g( {0 Wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
! z& V; K6 i/ c5 c! w- I}" g( W s+ y: t) y, y0 I" z
else if (document.layers){
, Q* Y& B2 Y8 n8 u [2 Rns_marquee=document.ns_marquee.document.ns_marquee2; I$ L/ ^ T5 }' a: Z( `' M
ns_marquee.left=marqueewidth+8
. \3 L1 h4 w: Xns_marquee.document.write(marqueecontent)( }) L; w! D1 J D
ns_marquee.document.close()8 k- A1 q, K' e7 |
actualwidth=ns_marquee.document.width
7 o* L2 c2 V0 f}
$ t9 i( {6 T; `lefttime=setInterval("scrollmarquee()",20)) r5 P* O6 z% ?, S
}
! C% a( c5 X: X/ X* uwindow.onload=populate
+ y, l8 ~9 ?6 V( {6 p
9 A% H0 `2 _9 o% ~function scrollmarquee(){) N0 q0 y4 ]- @0 h7 ]* y
if (iedom){
. _" u; \9 a% H& Kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* [& i1 @1 F, e
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed7 Y }- J) D. D/ \
else
0 g& Q1 v6 R. Lcross_marquee.style.left=marqueewidth+8 E3 L0 ~. H0 d( C- F; K, U& \" G
) j8 v- q. Y: l9 o! J- j}
" p7 e: e. r. k$ ?8 x2 r3 R! K Nelse if (document.layers){" \3 ?& h3 {! k7 j
if (ns_marquee.left>(actualwidth*(-1)+8)): t, b! P1 R( L G- i
ns_marquee.left-=copyspeed
1 `, m' O% x- A: ^8 ^7 r( uelse
# p; K1 u$ h5 z! Ens_marquee.left=marqueewidth+8& S! \* E& c' p; C0 s# u% p! I7 n
}
( g: S1 v! ?0 J1 p+ a}
^- P8 D! U# g) S8 ^9 A4 B( P0 D
if (iedom||document.layers){+ ]) q* R0 H( P$ m7 U9 E/ k8 d! l% ^
with (document){
% ~! ~4 T- M6 B7 l* Jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 K/ {: W% ?% F2 w, R( I
if (iedom){
: l1 H T* E: r, d% Owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# T% Q9 Z" G5 F. ]3 L4 o
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ c4 x" l3 a& Z2 x" s2 vwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 ~7 C5 e7 S1 a& }* k
write('</div>')
) L* w+ @4 `7 i( Q}
7 ~* z D1 X! Telse if (document.layers){1 j* A8 j1 A7 L$ [3 V! d" E
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
, H$ o$ ~4 |8 H' ^3 l8 o* l) nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 B- L/ X) _4 G" `write('</ilayer>')
3 r/ ~) B b% v}+ {% Y5 |8 t; ` Y- N$ }% R3 \
document.write('</td></table>')" |5 T( H5 n0 \4 p
}/ [1 ~2 l/ o& \- h$ k ^
}
. {- r1 p% r& N0 R) F" P* C$ T, y</script> |
|