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

|
网页之跑马灯文字特效
//修改宽度; s! x: u( K( I0 i, S" h# x5 |
var marqueewidth=300
8 A/ D7 _2 I! z/ @& _//高度
* p" \0 C- q/ ]1 d- Svar marqueeheight=25
# `6 f/ I; U3 @& `5 ]//速度(1-10)
& s( j# k6 S4 b+ a. b0 i5 N2 D! F+ e. R; pvar marqueespeed=3
4 U* u$ i- g9 Z//背景颜色/ ~9 p6 e2 ]3 H% f" _: |
var marqueebgcolor="#FFFFFF"+ V6 `6 O- s- V3 e
//是否能暂停 (0=no. 1=yes)?
2 p3 e% f; \& _; L4 X' A# Nvar pauseit=1 J0 R, P& t6 R5 J' h G. i
. z& Q& f$ O4 H2 O& H
//修改显示内容
2 ^$ p/ w$ R3 Lvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 R! d: b, {8 c9 u
: q5 W( d3 v: ?' m; X
1 C; ]3 r- B/ @% V% o0 }" I, F: z# V////下面不需改变////////////; j3 ?* _( i0 T
" s; X' m) T* M+ O# q$ ?var copyspeed=marqueespeed. Y8 B3 l/ [# Q t8 I. b' m
var pausespeed=(pauseit==0)? copyspeed: 0, X5 w' _2 N/ b1 B, S
var iedom=document.all||document.getElementById
4 q6 J/ o E8 ~8 Z. e. m, k3 oif (iedom)
0 O w a7 D5 m# q# k" ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ g* F- ?8 O3 n8 L) p
var actualwidth=''7 Y a9 b' r' P* p+ S! E7 @# p
var cross_marquee, ns_marquee
# P& Z- H {: Z) @ y% U9 J8 _. b3 N" d5 b
function populate(){6 b6 q+ g1 u3 S9 k
if (iedom){
, ]5 }: @1 V" L$ z; Rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" j8 Y' L0 Z$ g4 F
cross_marquee.style.left=marqueewidth+8
) L' {, x& k' A- M: J4 [* Ucross_marquee.innerHTML=marqueecontent
; Q7 d) {5 z% R2 eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ I9 L' i7 m7 z `& T0 N}# X Y( C3 x$ Z( B) ~( z
else if (document.layers){
: i8 ]& |4 J5 _& K5 Tns_marquee=document.ns_marquee.document.ns_marquee2
0 o, Z) m, \ Z: s, T# M# w. k) } cns_marquee.left=marqueewidth+8/ B2 l4 H0 j% Z" F4 [
ns_marquee.document.write(marqueecontent)
5 |/ h Q0 l& a8 }# jns_marquee.document.close()
( g6 _: `) N6 Q" r: jactualwidth=ns_marquee.document.width
; e/ B, u. `; c( h- s* x) h}
% d5 W+ r6 Q2 W" Alefttime=setInterval("scrollmarquee()",20)0 j# c( L0 W9 u" u: ~
}
9 d0 J% t8 M( j; \' h6 \+ _& Ewindow.onload=populate* x6 T4 l7 g. Y3 f- [! F0 s
* k) N4 I- C- n2 L% V7 ifunction scrollmarquee(){3 h3 I' M- d" a5 a8 @4 N
if (iedom){
- |) i' v6 o# R' F1 t8 Z( tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! u8 ]) I! q8 @1 J9 J
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# P+ L6 ?1 j) C) s8 d- j" U
else1 M/ }2 Y# d! P6 j
cross_marquee.style.left=marqueewidth+8
( y' G4 x! V# a$ J1 |# A8 g% Y! x3 i2 y
}5 W$ `# B% n# U8 m/ _
else if (document.layers){$ e) a& I" v* N+ W" V
if (ns_marquee.left>(actualwidth*(-1)+8))
' F5 z# u9 h6 t* o: Fns_marquee.left-=copyspeed
1 }0 a3 x! i& \( N& |else
~0 G5 g! b h- q6 i1 xns_marquee.left=marqueewidth+8
$ _& x" y+ b; A& `}; \6 n' F. a- n7 X0 D( S
}
9 g- B. j3 e4 c0 X+ R4 p
2 f, o/ U1 k$ e. F+ ^4 ] [if (iedom||document.layers){- ~* x; t+ C. ]+ s- R8 I4 s
with (document){
3 y: d/ M2 `. b! t3 v7 P* M [- Ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 l$ ~/ j9 ?/ X6 d- D" D: h
if (iedom){
2 R/ Z# u J- V- pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 [. Y5 W$ a% [% n2 H! Xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) Z/ }0 V* M# W1 F* b
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 s/ a4 a l' M; c, w5 g
write('</div>')
5 c9 O/ F# }' i* [% L# s4 W}
( G7 |8 v+ V3 [, k6 G+ U( {4 u2 Nelse if (document.layers){$ O% i8 @- r# t1 e& C% u/ u
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 n% B; d) H1 Q: awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. G. m7 p2 X! v% D" Pwrite('</ilayer>')
) w8 F; [* p$ w( a}$ p$ D( C+ Y$ u
document.write('</td></table>'): E, I0 Y/ U! }7 b. A- T
}$ ]2 ~+ ]/ M/ V* U, ?8 E# M
}
! B" K$ O) W* ~+ z* M6 G: |</script> |
|