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

|
网页之跑马灯文字特效
//修改宽度
( T6 f! L& v8 K5 c, S7 o8 tvar marqueewidth=3008 Z- E) j6 r$ g3 m8 L9 {7 _
//高度( L# V. A$ A9 M
var marqueeheight=25' O3 R5 \ S9 K& N
//速度(1-10)
6 |0 G' E8 O; K& zvar marqueespeed=37 I) S8 L" w. k/ A/ Q; v) t# k9 E
//背景颜色
# M7 z! `6 g) ~: h9 lvar marqueebgcolor="#FFFFFF"
3 [) T: X& m) T P//是否能暂停 (0=no. 1=yes)?8 J" i! G% a6 M/ J
var pauseit=1
" v9 x$ d) G. c1 h
: O' r2 L) m) _//修改显示内容
/ y: ^0 @6 A. `9 @' i" g9 ?var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ K8 J, l2 s% _) t$ C
( Z$ ~* l( S- ~7 [, u' d3 p I* S9 v! I0 P1 t( C+ S9 r% i
////下面不需改变////////////6 T; i" l+ ]! l, w8 c; l
! A+ ?: w) k, o$ y+ Ivar copyspeed=marqueespeed: q) d, ] U) b: o4 }
var pausespeed=(pauseit==0)? copyspeed: 0
) F$ K! D' W% c# {1 D" bvar iedom=document.all||document.getElementById! [* P5 h! Q0 j9 A6 @$ C
if (iedom)& Q2 V% A2 s3 m/ z
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' O8 X9 C* B( ]2 k: Y* ?
var actualwidth=''" G7 z; q7 Y3 S% u
var cross_marquee, ns_marquee
% |/ E1 }( T; P( Y; b l( F3 `5 I; ]8 I2 u
function populate(){, z: Z. W7 h3 q/ W( w0 t$ v! i
if (iedom){
. D5 _" k I9 H+ I( jcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee v4 k* R' q$ c; j+ t
cross_marquee.style.left=marqueewidth+87 R! s6 B S$ l# R
cross_marquee.innerHTML=marqueecontent
3 J: ` s3 u& Q3 Vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% q# K9 l g9 ~5 Y4 |* s}
' M' s. W7 J- q) a' ]0 {& A. gelse if (document.layers){6 n: _; {1 r) H
ns_marquee=document.ns_marquee.document.ns_marquee2
1 |& e) b% n( m9 Y& E$ cns_marquee.left=marqueewidth+8& ]$ v$ r8 s' |9 }& E: N
ns_marquee.document.write(marqueecontent)6 v# l+ i% W1 H7 ?2 N
ns_marquee.document.close()
0 S+ N% \: k+ ]4 j" {- oactualwidth=ns_marquee.document.width# H* k, T0 d- A
}
4 K/ z# B, v/ [1 klefttime=setInterval("scrollmarquee()",20)
" Y& K% F8 U; U$ ]: X}) h) U# k3 t7 o0 z4 M5 F3 f' g# X
window.onload=populate3 E: ?8 E& D! d; p; q
9 k f) u5 t; n, Efunction scrollmarquee(){
& G8 _: l. Y9 S! S0 Yif (iedom){' E. I3 Y9 u$ a3 W$ R8 O6 h! F
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
y e% A+ e+ _* d) kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! K% D+ Z5 u0 H; z5 b4 x- l; F
else
D1 K; n5 ?. z% s" T% Ocross_marquee.style.left=marqueewidth+8
5 N; J. L, E+ p: {& J
`+ o: g' j: b}' f/ b& N6 S$ b l, \, i
else if (document.layers){
% I1 P0 W/ l% ]" ]; }: @0 C9 }if (ns_marquee.left>(actualwidth*(-1)+8))" _5 C7 b- Y" H. [
ns_marquee.left-=copyspeed
6 H% j2 n0 |0 {, P% T `: c; Gelse
2 C5 c$ G3 \) [8 Ins_marquee.left=marqueewidth+8
E$ `0 g9 g' h/ D$ z}' `0 D% r+ Q( e4 \; e) G6 S: w
}/ H5 a8 {* @# d) G$ K U
8 U) G3 B% `& B! Y
if (iedom||document.layers){
- v! o' [$ p% N v1 xwith (document){4 t3 G1 G4 X/ s6 d% y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 v, ~8 w u/ e$ O
if (iedom){
; x3 D2 N2 p kwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* r4 |( d8 P- @" ~; _- t3 rwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& z7 F# g6 y2 C
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')5 s: F6 R5 U! Y, Z
write('</div>')8 e" N) `5 _6 |3 y5 d; y
}% U" n9 Q. U: N% H" `7 @
else if (document.layers){; i+ T/ y( c; F" f" d) M
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>') S a; D( H0 n9 q( ?; i
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>') o B3 h6 C9 m- G# Y% }
write('</ilayer>')6 \# N& X% Q. f0 w- ?
}4 x0 v/ ~7 @7 {0 |0 P, J% y+ }
document.write('</td></table>') {, L* a, n- w1 t
}! z; z& u, d7 T! j1 U4 p, o9 v
}
$ b, y, R# D2 x# j, g/ X- e: p</script> |
|