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

|
网页之跑马灯文字特效
//修改宽度
! Y h8 W' @7 c8 E. |var marqueewidth=300
* w2 K' _2 _ ?//高度! G& O" k( \& H* \/ x
var marqueeheight=250 ?# F3 @0 t& H- k$ W( x* z
//速度(1-10)
: d. p6 h) _: M: N8 I: wvar marqueespeed=3
6 ?: ]6 z/ w, o5 p7 U//背景颜色
* E* K% T+ w3 a+ t% `5 }var marqueebgcolor="#FFFFFF"
# ?2 L8 c! ~$ O; o6 R$ y//是否能暂停 (0=no. 1=yes)?
0 r' `0 Y) f/ s9 R; z' y$ I" qvar pauseit=1. `$ D2 N! M4 G! T! v
P) _/ t/ Z" T
//修改显示内容
& y% U% o6 t# d- C% w: Xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 Z2 R4 T+ | A6 `) j! m1 G! `0 u$ j2 E9 S4 ^
5 p( `' M% _ p6 k4 a u" n////下面不需改变////////////) Q5 e3 _% Q( B( z Y6 }. a; l
) _) O/ c& Q' |var copyspeed=marqueespeed
! r8 `# W# k' q, m: mvar pausespeed=(pauseit==0)? copyspeed: 0* y( ~0 X9 l1 t6 K% Q
var iedom=document.all||document.getElementById* b$ m4 x$ V9 `) } R! j
if (iedom)
( I; u, X1 y0 b' ]0 ^' @0 }: ^document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')8 A1 _+ K1 e4 w" J
var actualwidth=''
, ~5 \: M2 c/ R+ ]& }# g! Jvar cross_marquee, ns_marquee: D E6 g9 s$ Q, f
' O0 p8 u z( K( O3 ]$ M- pfunction populate(){
l( N. t0 m1 g( l: ^if (iedom){' |1 ~6 E1 G& D7 o
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
Z, b' u4 f4 _cross_marquee.style.left=marqueewidth+8' N9 Y! `" @/ G; L F
cross_marquee.innerHTML=marqueecontent
2 w4 n6 k: D. b' Tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; I1 v% x: ~# F( @9 `1 x% Q
}! u) W' ]" ^' r% f* \% W
else if (document.layers){( }7 p: c8 Z9 `9 |- i, r
ns_marquee=document.ns_marquee.document.ns_marquee2) ~6 s& M' g# h) b" r
ns_marquee.left=marqueewidth+8
+ k7 ^2 O4 _0 [! \ns_marquee.document.write(marqueecontent)9 H& R: j0 p: X2 Q6 Y
ns_marquee.document.close()
2 q3 Z3 ~) I, Wactualwidth=ns_marquee.document.width
8 j7 R# c8 W2 g( E0 g6 L# Z}
$ o3 ^7 t: ^" qlefttime=setInterval("scrollmarquee()",20)
6 i" n5 H- i+ v) A. s( P}# \9 T4 s: h, M0 b( `
window.onload=populate
E' R" \, ~# G. @% V3 H
2 ?2 t; I3 n% i# Lfunction scrollmarquee(){( j1 M: R0 }5 D, o
if (iedom){% X: o1 `% d! c1 u0 g. c5 P
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
P+ N. L1 \8 Y4 m% d" icross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) S9 l, y7 }# ]else$ D Z: G9 _% X: F) `) [" x
cross_marquee.style.left=marqueewidth+8
7 `9 [! I9 e- R& u8 d, \+ b3 B W- @& P+ G/ e8 E9 h. {: J2 ~
}3 X, V1 i S2 d# e7 {/ P
else if (document.layers){
6 X4 n3 Y! y7 Z9 uif (ns_marquee.left>(actualwidth*(-1)+8))
# O+ m* f9 ]! }9 gns_marquee.left-=copyspeed4 u5 ~8 Q2 G; X! _8 U( K" N+ t2 O
else
3 q! E- i, j2 ^3 |ns_marquee.left=marqueewidth+8
- n; K, N( z6 z0 N3 l8 ~4 [}
% C; c6 L/ h( y9 d( q" e5 S$ O* q}
6 _* l8 t7 l6 w
2 Q* x: q G' Z1 _& }" ^if (iedom||document.layers){& E3 R1 `1 y; I) M
with (document){
* C, f0 ]4 @7 \! L( [, I- J* qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ t1 E: Q+ F5 h3 a9 Z$ h) Eif (iedom){! _6 e2 W* F3 {% h8 Y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& c4 K2 I. k& M* o. Nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, o0 b0 c3 M+ X4 gwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- }& [* i/ u1 D& H. l5 R
write('</div>')
: E' {" [3 A$ k6 X}
: H6 E8 z8 N: Q9 O6 W& @$ j3 I2 melse if (document.layers){; N- O' B. m, e- I
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 O% t0 M) U0 l' K' u2 e+ {/ rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! }( H- C9 Q* K3 O
write('</ilayer>')
2 w, X6 i. T4 I P1 X4 m! O}
; O: o# }+ q: y8 l* \document.write('</td></table>')( d! L6 S% X) f8 n/ W# [1 S1 r
}
9 z/ M$ I( ^4 `6 e4 T4 g}1 x Z* X% D3 \6 M3 @# X
</script> |
|