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

|
网页之跑马灯文字特效
//修改宽度1 A: ?% c* {2 |8 B( n: [- Z
var marqueewidth=300
! D5 Z$ s1 e5 C( p, G//高度
' ~, k5 b) i3 z2 yvar marqueeheight=255 `) C' f1 S( Y4 S/ F0 o& D
//速度(1-10)
4 x9 }, m/ ]& z. {% Kvar marqueespeed=3
! G O8 U( w& ]2 ~7 P//背景颜色( K1 v0 l, U6 S0 T& Q" J! V" H
var marqueebgcolor="#FFFFFF"
5 E* ?% Y/ V' q; m( ]5 Q//是否能暂停 (0=no. 1=yes)?( ?( V. f8 p: f! {0 ^+ m) g8 n$ ]
var pauseit=1( x7 R1 g7 A I% U+ p
$ H+ L* o4 T: J& U8 \; k* U7 B5 b
//修改显示内容
" e: s; C8 J8 m5 A; k5 @$ L3 g0 dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 a& q! y9 f0 ~" x- \5 Q3 }4 i+ I2 }+ J" J$ F9 D- j1 U
0 D' e: L1 J' ?; d- ?" _- S& m" F////下面不需改变////////////
$ n, J. j8 M- c S" v+ R# H3 N7 ~# z8 ~% \# h3 m2 t- c$ W0 H
var copyspeed=marqueespeed' f& t# }' G) Y% ]
var pausespeed=(pauseit==0)? copyspeed: 08 u5 H: d- @6 F# t) q7 [
var iedom=document.all||document.getElementById! d4 S7 Y& ]' t( v
if (iedom)
% h: B! Y. G1 H& w& J( M) K/ O, y7 Zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')# `2 q9 v2 c& G) e
var actualwidth=''
3 v# m+ N0 f, qvar cross_marquee, ns_marquee4 q V/ S3 D9 }% Y) u- O- E
: ? P. R& a; G) M6 O/ K
function populate(){8 ^" m! M" R7 _3 f
if (iedom){
+ R) Z+ s6 q i9 ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee l% G& ~0 c4 m, p0 E: n
cross_marquee.style.left=marqueewidth+88 V+ b) n2 O- x4 h x4 @
cross_marquee.innerHTML=marqueecontent
$ P* G8 K% Q; O2 F9 }actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 f0 M9 S/ k; ^7 M5 @5 K}5 a. h2 h0 [% D6 j5 T" L4 A
else if (document.layers){
. L# N B4 C) D( F6 L$ `ns_marquee=document.ns_marquee.document.ns_marquee2
, f/ ~1 Y! h% zns_marquee.left=marqueewidth+8
8 V! P' c# o# N$ }8 T5 K0 ^- `ns_marquee.document.write(marqueecontent). t! Y3 c# t6 ]6 S2 }3 ]! W
ns_marquee.document.close() A& S* l$ h" J- j
actualwidth=ns_marquee.document.width* C+ F E$ Y9 Z& W' @+ ^
}
- h2 O ` V7 Jlefttime=setInterval("scrollmarquee()",20)
9 I# J0 J0 K9 u' i& e}0 h, M1 `! Z6 }$ b: f
window.onload=populate% A. b ^ n/ C& {
" s1 L! p' c4 D1 Tfunction scrollmarquee(){
) |3 Q. s* `+ A( |& E% O# hif (iedom){
7 m2 _: b' _7 u* b+ q* {2 ]# Nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) i) S3 V! \" j. t, ~+ Icross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 ~6 R( X0 `; ^ z
else8 k' ~& ?6 P# K& J* n+ P
cross_marquee.style.left=marqueewidth+8: w9 R, c8 H+ G4 _; [- j7 V
# r( W2 L2 |7 u: O1 p}
0 q2 s8 A( w3 A6 l7 pelse if (document.layers){
* \: f8 H+ i2 D c- mif (ns_marquee.left>(actualwidth*(-1)+8))
9 J5 |3 \4 R! h T9 d- L0 i, W0 }ns_marquee.left-=copyspeed
0 M" I* C+ h+ \9 U3 P5 X, Jelse
0 _, c; \- d% s& Hns_marquee.left=marqueewidth+8& d' k4 e$ C9 O) E7 `5 N0 S
}, b7 A6 d$ ~& E `: S( X5 ^+ p
}" W/ z! i% N+ E A8 _( z. I% t+ \
: }1 x( D; p: d2 J
if (iedom||document.layers){
$ {0 p' P+ Q) ?) jwith (document){5 h Z# o: ~, b$ R' A$ H
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 @1 k$ S2 j6 }$ G# S4 F } a
if (iedom){6 N2 n8 P' V3 d* E& n" F
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); K1 I$ E% z" x4 p4 q- F
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- V& o! \7 K0 Q7 O/ { Iwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ h/ H. Y# i1 [/ B/ o& t0 [( d* b
write('</div>')
' i: ~9 _. e/ a! C+ T j U) I}
4 {; x R! V7 relse if (document.layers){/ E; h5 Q6 A8 Y& c$ U& c4 y- F
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')# Q% m; a2 y4 y( Z5 u
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 s& k/ Z8 x1 Z7 d8 r
write('</ilayer>')7 J5 N; `+ ?$ N4 s
}9 T) g6 A% Z, k! i6 G; \
document.write('</td></table>')7 I2 Z4 r' a, C4 D7 j) ~- |, R
}. g+ O3 L3 d1 e6 ^1 G2 U
}
' n+ z1 ]( z& E+ ]( P</script> |
|