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

|
网页之跑马灯文字特效
//修改宽度# Y. s% i/ e6 \- ?
var marqueewidth=300
. T, P( u. n- c8 T1 C# a//高度% V3 m; M. X1 S) F
var marqueeheight=25, x ]5 K$ W9 {' F( _! r
//速度(1-10)+ b/ e# [) L- ]% l, l& z$ R
var marqueespeed=37 C# m& [: _. {: |
//背景颜色
' _/ g; y5 Q7 N- u$ S6 e l1 Cvar marqueebgcolor="#FFFFFF") ]$ B3 C/ ]3 c) B
//是否能暂停 (0=no. 1=yes)?
. g q. I* |' n/ {; [var pauseit=18 T& U7 @/ Y# u2 T
( v7 G" ], \% G7 U% C//修改显示内容5 I6 K$ A. I2 z. p. x
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'$ X3 P5 v% {2 h/ r
$ f" g g) E" R+ p; V* H/ K
4 }9 ~( L) e2 u////下面不需改变////////////
" U; [6 y, ?: E: n0 F$ J
6 C1 V1 }& F0 v( N7 u2 F2 yvar copyspeed=marqueespeed
y ~8 S+ |% T( L; c8 V8 H/ S3 Rvar pausespeed=(pauseit==0)? copyspeed: 0
4 f% V l' d; W3 b I; z" Ivar iedom=document.all||document.getElementById/ \8 l% B# w; {# ^
if (iedom)
; ~6 h2 Y# h6 {8 U0 Bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% E( K$ D' F1 q1 [% G7 m: jvar actualwidth=''
$ d/ F. K u0 q1 Gvar cross_marquee, ns_marquee
3 r0 ` s5 |' C# z \! b+ j' |* B( ?- ?
function populate(){' w# m! d' [6 u. k
if (iedom){
1 a% d4 I$ Z5 m% hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! q, s! r; Z9 Y' V6 Q8 w* J) ycross_marquee.style.left=marqueewidth+8
3 }1 ?6 |. z2 v& _7 B6 B" n5 }cross_marquee.innerHTML=marqueecontent
% ]4 ?0 c) A0 cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 j* y1 [8 ~' m" }6 _/ K
}
7 }2 \8 d9 ?) u2 K5 gelse if (document.layers){, X6 F( O5 k) q/ q$ i1 ?9 R; z: {2 A
ns_marquee=document.ns_marquee.document.ns_marquee2
1 N% t1 O6 Y* W6 z* rns_marquee.left=marqueewidth+8, I% s$ C4 Y+ @: u) r/ \: Q
ns_marquee.document.write(marqueecontent)
( e7 X7 Z4 r. K( j! p9 vns_marquee.document.close()8 w) W2 _( y( R: _, D( `
actualwidth=ns_marquee.document.width
r0 @- k/ d% O: W% H% M8 O}
6 C. ?# h/ A, s$ w/ O+ O0 qlefttime=setInterval("scrollmarquee()",20)3 u# ~% T. R+ Q( s( C) H4 X4 i1 s- l
}
! l4 C$ Z( B9 h" g" H0 Ywindow.onload=populate4 q( N; U! z. ~# K$ n
8 U- [+ I+ N y6 Rfunction scrollmarquee(){. P/ y) w0 d A9 H
if (iedom){
! R5 }3 G2 i! I' ~5 bif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# U' s, K) _% t1 F1 s9 X% @: J4 v
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: N- s+ n# D6 X5 p: z* z& K( h* u$ _else
+ e3 l, o% ], S- ccross_marquee.style.left=marqueewidth+8
" u2 S* K, r# V3 H( G1 g" l M" k' `: X# a+ q- m9 i, \; j! U
}
: A- _- r$ O+ E3 P% Relse if (document.layers){2 R$ N- {# x; p& G7 m, m
if (ns_marquee.left>(actualwidth*(-1)+8))9 Y2 T& f8 j1 p
ns_marquee.left-=copyspeed
' h @: ~& j9 e+ velse
2 Q" M+ h2 N! G i" ^+ `5 n6 gns_marquee.left=marqueewidth+8; _- M' Y; j2 g. Y) p1 @
}1 \6 y" s2 |, G5 V
}
, u- B/ q9 C; A) b2 P( @1 o! a; [) X. I
if (iedom||document.layers){! w4 C2 e- r2 A
with (document){
) k0 b# q+ \$ G6 k" vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 b7 `% A* o" Y5 H# [
if (iedom){
$ `# a, Y& ^: @5 Bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 f7 U6 b5 D X. q: swrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& u7 q/ j8 Z8 o6 f' o5 k, v; Y% m0 Rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 T! ?5 W" D; G8 U1 ?4 k+ V
write('</div>')' K% [2 E* b; V* ^" w
}5 j" T/ ]+ U: H( T" v: _- ~" ^
else if (document.layers){
. n! B5 Y6 ^/ v8 ~write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( b b& b( ?: U5 H
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')+ }; Z. T$ F% N# E; V
write('</ilayer>')
/ T/ B/ x+ v1 y}$ T6 D, P1 X0 v: w$ y# z
document.write('</td></table>')" r) W+ Q# l; z. F* b8 _7 T& Q$ V
}' @' e- R, C% z
}! M; P' l8 D5 i* X7 [4 L* C* ~
</script> |
|