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

|
网页之跑马灯文字特效
//修改宽度# S0 G8 z" O3 L: r+ b1 @6 x2 T
var marqueewidth=300
$ r5 l0 q% n1 n h//高度- B u% ~& }0 ~6 F/ _) l
var marqueeheight=25
+ Y6 o7 s& A& c7 y! n, ]& S3 G//速度(1-10)3 W7 E3 r. B* M R
var marqueespeed=3- R- r" a- S8 s8 b
//背景颜色4 A4 J. e0 e% F, e5 t5 l
var marqueebgcolor="#FFFFFF"
$ I: U: M' l2 @+ ]4 e5 C//是否能暂停 (0=no. 1=yes)?
X5 D" y! Q5 v0 \0 z+ svar pauseit=1- r8 X5 m: c! n- Z$ f9 J8 f; r
. T$ P8 G1 b' U( c, N//修改显示内容9 i i7 ~2 E0 W& H5 I" v+ S
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- [7 C/ }9 H& L* P- @7 H
) V8 [/ o% J/ r1 V# h9 L* d
* ]/ ^& Z! t6 g$ ~////下面不需改变////////////
' |0 G% h7 `( t& a- G
4 T6 m5 t6 l2 Z5 avar copyspeed=marqueespeed8 Y. w9 c; g$ R- J" [7 a$ z; o
var pausespeed=(pauseit==0)? copyspeed: 0
0 K' ~3 y( O* b' Dvar iedom=document.all||document.getElementById l) s8 r q& T& Z+ m4 _
if (iedom)
& `* h, @, S* X, I& z0 qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, G2 h/ K9 d$ n1 \* ]var actualwidth=''7 M* ]! d: {0 W5 z Q
var cross_marquee, ns_marquee9 @% e% ]5 v0 F% }
0 S6 r( _0 z1 e; F C7 S/ H% g+ t
function populate(){* i; M6 X! j5 x Z
if (iedom){: z( a4 o- W2 C% n1 ~
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 ?9 A8 l: k! y3 t8 E# x4 ~: H0 o
cross_marquee.style.left=marqueewidth+84 e( ~, K) c; z
cross_marquee.innerHTML=marqueecontent8 A/ ^7 V; o! x2 U# }
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 a2 ?4 W# E0 p
}, ^1 D% _) b% z6 I5 `( q( i4 u
else if (document.layers){' `7 d6 X, t% z! _- g o) \
ns_marquee=document.ns_marquee.document.ns_marquee2
5 c- p" x. G8 fns_marquee.left=marqueewidth+83 k! U6 a( [$ A" c' Q4 W( h( \
ns_marquee.document.write(marqueecontent). ~5 e( [9 l0 c- `4 v8 @' n
ns_marquee.document.close()6 h0 n; L0 Y# Z2 W
actualwidth=ns_marquee.document.width9 l' O- W8 Z4 U. \6 J9 J
}( O9 h2 T: B2 Y8 d; v
lefttime=setInterval("scrollmarquee()",20)$ }; b& ^! o+ E3 l
}
! A9 j5 J9 g' b1 M8 k2 Q3 cwindow.onload=populate
9 [/ f/ r: j( G4 }
6 Q8 T1 ~- B6 _function scrollmarquee(){, O; n( s& C0 B
if (iedom){
3 ~& J9 j$ f/ ]if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' P" q f; \: w$ ]6 I0 J, b4 S; }
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& @) T. P" Z) i, D% ~! T7 f$ f, a7 _else
& X- w- q: O7 w+ C& U7 b% Wcross_marquee.style.left=marqueewidth+8: c: A6 _+ E h' ~/ b" M' S
/ D# C% m# o% e
}
) Q% f: H7 Y7 F4 }- w+ P( velse if (document.layers){, B* l" d; n( {2 U! [/ x& ~. Y+ y
if (ns_marquee.left>(actualwidth*(-1)+8))
g. t* A1 m; |$ s% s% tns_marquee.left-=copyspeed
! r5 C' J+ U0 ]- x% n. lelse
% X0 E9 |& J6 H8 x3 N; p# zns_marquee.left=marqueewidth+8% q+ S2 P- C5 C; ?4 a1 H
}
6 B( F% [. o' c5 K9 ]! r2 a; D1 r}3 N9 T: Z. S( x* ?
! I+ P7 v! C# w4 l2 T% {& b
if (iedom||document.layers){
8 p i3 O( x. S: T) O3 H) twith (document){
9 }* `! v/ W$ ^. Jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" a2 N' O# c5 S( F
if (iedom){1 e( t. _( R! J
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')/ _- S8 S7 A$ M$ _1 G. y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ l; p' b" d! bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; n4 a; b4 ]4 v3 l. Owrite('</div>')
5 P! B |' Z/ I}4 E' Y1 t X0 w+ M# `* K
else if (document.layers){- ^& V7 C5 Z& `9 {
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( g+ O, q+ ]5 A3 y5 @0 X
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ S# G8 d; s. @, C/ @/ q) S" u- F
write('</ilayer>')
5 U$ C3 a- B; Q; |! ~4 v* d z! k} r( y9 ]# Q7 t6 i) N: G% U
document.write('</td></table>')4 |7 `3 ~/ `9 i5 N' Y* n0 J
}
3 c! {' G" a" Q& @}
7 t% o7 ?8 G( c: f</script> |
|