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

|
网页之跑马灯文字特效
//修改宽度
5 \1 U6 W _7 \( M% I& ]! Svar marqueewidth=3007 f; p B. h* P( @ Y5 J- R
//高度
. ?' d) G6 _; U- V! T0 Fvar marqueeheight=25
+ O$ j5 V/ t) G9 d5 q3 s; ]//速度(1-10)* q+ e4 s2 ?9 b3 H3 v3 ^ @
var marqueespeed=3# C' w) e+ q* x- a* h5 g/ l, C
//背景颜色
) k: p9 ?/ J9 S0 Gvar marqueebgcolor="#FFFFFF"
( P+ D1 d- F- e) y# s- g. @4 o//是否能暂停 (0=no. 1=yes)?5 M" a) V7 |, J4 e
var pauseit=1
1 w2 L5 J F* i0 \+ o; G4 |. i( M+ s" M z5 K4 L1 D
//修改显示内容
/ C( @2 h* G8 S `+ d! w9 Fvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 H8 s0 X+ ?; o" b2 J$ ^
8 N5 r9 ?( N; s' s8 e6 p8 _4 E( \1 H
////下面不需改变////////////
7 L: }( n, M# {6 X3 W
/ M9 T$ {& T. O) P& M: tvar copyspeed=marqueespeed
! i# x* q6 D0 d' W/ h$ G! Cvar pausespeed=(pauseit==0)? copyspeed: 0
. }0 t* ]' V- L& z% s- l k& vvar iedom=document.all||document.getElementById
( Y2 r' h# w% ~( t* c0 sif (iedom)
7 M' S @) [7 i& X; u, Idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 Q5 U4 `9 j. i+ O. H; r
var actualwidth=''
' J. l; D) s' w, mvar cross_marquee, ns_marquee
$ k6 \6 Y0 ` e9 }- W+ N q" q1 j" v- a% d5 ~& l# h+ ?
function populate(){ h9 q" t8 |- m' Q e7 m5 Z
if (iedom){& ~' b: c* N! G
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 s+ K6 C9 T! i# }
cross_marquee.style.left=marqueewidth+8
3 Q7 z0 l( u. H4 ?; Q0 Fcross_marquee.innerHTML=marqueecontent
; ~+ m/ U2 r# F$ L6 Jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) y2 A F6 } j* E' E8 n$ O
}' Q( [' |2 Z( Z6 `! J
else if (document.layers){
* w) B' I* C% B, l6 T6 cns_marquee=document.ns_marquee.document.ns_marquee2
A2 R; W6 p% |1 j& n" E4 m9 Bns_marquee.left=marqueewidth+8) T5 O3 H E6 d$ X% V% D, @: h
ns_marquee.document.write(marqueecontent)0 y: [ }9 t5 E& o7 E. v
ns_marquee.document.close()3 ]! l; u% S9 b+ n5 C* `
actualwidth=ns_marquee.document.width, j' p5 `' d4 f, L
}
8 J' S9 [3 N+ I; Ilefttime=setInterval("scrollmarquee()",20)
! f2 [5 A. l. u( p4 \* o8 D}
; H# I0 p6 N$ M$ P" o. l/ E8 D2 Z* @window.onload=populate2 C* X% ` I' \ Q8 P* ]6 S
' `0 }& o0 u' sfunction scrollmarquee(){
: A2 ~; g( L& Y9 sif (iedom){. R( s) l( }: j' m# I1 B0 f
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), p! R+ m3 `0 s" W' I4 w g
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed M1 ?0 x4 h+ |* Y0 a7 \3 o' D \
else
3 N6 h+ y" K, Z( o0 rcross_marquee.style.left=marqueewidth+8" h/ V* D2 q2 L, r
/ m! X. b' v( M; d1 l W3 E}" V" l/ B/ b4 @, Q
else if (document.layers){+ ~. w: |1 C7 t3 e* r
if (ns_marquee.left>(actualwidth*(-1)+8))
) e( P# q& u8 `ns_marquee.left-=copyspeed8 \- Y1 _4 K7 q1 f# i: A5 W" {
else
T7 K$ l6 V( l5 d* L: bns_marquee.left=marqueewidth+8
3 z# u7 P' F% r$ q" J3 @}2 P5 z% V6 a T2 q- m
}
5 t. f& s- g2 d. r9 ]! d. {' h8 B, k5 K. I- e; O
if (iedom||document.layers){, k' W: p% A% B2 B, L
with (document){( X. p, o0 B$ z/ K. n9 f
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% t3 q/ Z, R, M1 O1 y+ p
if (iedom){* g; L0 l. J G, M* ?# k' A
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')/ M7 E, T8 k4 C
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 I4 `: `4 M" W( S$ V3 S! @
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 O7 U2 _" C$ @2 N& H
write('</div>')
! N* M! ^2 p- I4 K}, x" F( v6 U7 x: p3 r
else if (document.layers){
8 j5 c5 P' |/ m! N# ^write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! v4 p1 Y8 w: R1 H' d7 I
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% R9 C8 ^6 \8 r0 C% bwrite('</ilayer>')
4 c0 I- d" R% E, C+ ]1 E$ E}
3 d/ k5 K1 p( l8 Ndocument.write('</td></table>')/ L/ q- n! Q5 ?4 C
}" c" w& s. p, m* H* J- _7 \
}
/ F4 T3 m# D# P( U</script> |
|