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

|
网页之跑马灯文字特效
//修改宽度2 ?8 H* J( d, F/ D3 P, h
var marqueewidth=300
- D( v2 ?* ]/ v7 | U( c# s) T//高度
' T% }, @& w3 n. i9 dvar marqueeheight=252 H' y1 N; F0 ?4 l9 F
//速度(1-10)
/ ]! H+ A/ ]8 ?( r6 Gvar marqueespeed=37 g2 z2 D" v- w0 ^) M7 z% i
//背景颜色
3 j! m2 ~0 E; E. L6 avar marqueebgcolor="#FFFFFF"
% K. V2 q$ F" m+ R( W/ Y1 k//是否能暂停 (0=no. 1=yes)?3 u, I1 e; {: x. ^) Y u a
var pauseit=1
1 X6 {2 U9 B5 F: l- ~, l* B* p+ u4 i$ ]' B
//修改显示内容
3 B; b9 A7 V8 T9 j: hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>', K- F& T! W& x0 A+ {
, I- ~) H0 G2 F
) G' i" n0 o% V0 r7 f////下面不需改变////////////
3 x7 |8 p/ z0 x/ O$ w! f9 m+ T6 z ~% `; [2 e' }
var copyspeed=marqueespeed1 I3 L* k6 o' l7 U1 z7 I3 J
var pausespeed=(pauseit==0)? copyspeed: 0
^2 \6 I) S. q3 }! w X+ Vvar iedom=document.all||document.getElementById4 O: w9 j. |8 g! C6 A
if (iedom)
) h: V, S1 B3 I: u* ~8 Bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 @8 N: h2 |, X0 d/ {
var actualwidth=''
8 m# r U0 e2 ]1 O2 H. Rvar cross_marquee, ns_marquee
) I' F$ ]. ]* J" _0 V* F5 L7 L/ M4 m, A
function populate(){( n* X8 h6 _' v- Y. _! ]
if (iedom){2 ]) Y' G. V) A8 X: ~# ^' Z# E4 c
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee ^4 {4 o Q) X
cross_marquee.style.left=marqueewidth+8, K! n" \ |* J7 y1 E# T) B
cross_marquee.innerHTML=marqueecontent; g% K0 j# n+ W& S1 O% Z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ C2 w2 X; f0 p) R3 O6 s}
- o9 {7 F' I! D9 ]else if (document.layers){
/ L5 m( Z4 }$ s& W! P( pns_marquee=document.ns_marquee.document.ns_marquee2
) X" `" q# W/ X9 H% k, y i. \ns_marquee.left=marqueewidth+8$ _- V( E3 K. F; L, N
ns_marquee.document.write(marqueecontent)
. V. V/ Z% |; \+ M: c- f* L7 S0 h5 Wns_marquee.document.close()
4 [$ U/ O$ \" L6 J$ eactualwidth=ns_marquee.document.width
4 w- C% Y" @" L: @' R+ u' P}% q+ K6 h; K8 S) b
lefttime=setInterval("scrollmarquee()",20)
& J$ r" Q$ i9 u5 h7 J}
3 w# m0 P8 u0 S) y5 ^: Jwindow.onload=populate
* Z4 ~4 P' m2 _
& R% w Y" u1 i1 }0 rfunction scrollmarquee(){
8 F# h6 ]' c9 bif (iedom){
6 r( V. E6 Z' k; s% P4 mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))- \5 b: ^( h& j0 i( F, {6 C* O
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 Z, c. p0 V9 Kelse
; J$ `3 g) w* tcross_marquee.style.left=marqueewidth+89 `* k1 ?# i/ v! `1 S6 ^' ?" G
0 g7 p0 A) Q! X; n* P/ l2 H}
; N: `4 ~4 {% @( e* ~1 p/ Lelse if (document.layers){( s0 G8 J% W8 Z& [* T2 t9 \1 W7 H7 ]. O
if (ns_marquee.left>(actualwidth*(-1)+8)); t. w8 w& b% A, ]
ns_marquee.left-=copyspeed
8 f! ]! X2 H3 relse
: B4 X* i' f( d, [* f* ?; `! Q. nns_marquee.left=marqueewidth+8/ s% ]9 N: a {( F9 F6 \
} [1 `& L W, ? }1 D
}' x% i6 u$ Q( e3 F4 Z$ K3 x; w' B. x
1 ]9 W( H3 X, A& p9 ~9 V3 {
if (iedom||document.layers){
( b! U- u+ x4 t# [with (document){& j0 E& x% i* ], [# V# m0 X. Q
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 z2 l, z0 O) m+ z% ]1 T3 aif (iedom){4 P& E, E: k7 n1 E
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 `! d% h) W# q1 p ]! A; e
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 q& x+ i8 d+ J/ _- \9 Z5 t
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ C! d# s- ^2 u" y9 ewrite('</div>')
; E0 ~! f4 E7 w) w5 I1 i}
; N7 M- l/ w6 c2 k5 celse if (document.layers){
2 V! @6 W1 B4 F8 F4 y* F0 awrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>') h5 C" H: C0 e
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% n: O- n' j& b; n9 p
write('</ilayer>')+ D6 S% ` x$ r; ^7 f
}
/ d% |4 B7 t/ V/ y( @9 E6 \8 Ndocument.write('</td></table>') d4 o& |& u2 }% i7 ^$ w# m
}
7 ]% @* D1 y @4 K. F}
4 S! |. ?" X% @1 D3 ~- X+ @</script> |
|