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

|
网页之跑马灯文字特效
//修改宽度8 J/ T- z0 W& u# ]$ E! K8 R
var marqueewidth=3003 H- a# }6 x- P* F" A' q$ V
//高度0 v( `$ @1 ]8 h* B. x7 P: w# P9 Y$ p
var marqueeheight=25& ^9 ~+ V1 _, J; R/ B7 w% [# m; E
//速度(1-10)
6 O6 ?- |- n" n* I- S+ fvar marqueespeed=3
* s w9 S/ k, d% Z- O2 E9 j5 |//背景颜色( l: f! D2 @3 I
var marqueebgcolor="#FFFFFF"" D9 {8 `6 j3 j: w5 e/ M
//是否能暂停 (0=no. 1=yes)?
0 Z P) f# o- r# H; H) ^var pauseit=18 W& F8 a' p* Z- `) ]
: _: W, r& P' U4 c
//修改显示内容7 b2 i j7 u, y- H0 P& S. u K( K/ k8 \
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* @! U, r4 k1 Y2 Q: O4 l
* S( y6 o# M. S' ]3 f5 i
; ~! |+ m$ f6 D- v/ T- z////下面不需改变////////////
2 j L( V5 l) k% k& E% R6 ]5 Q" }' w2 S e# i% C w# V
var copyspeed=marqueespeed4 l" a8 T I' u
var pausespeed=(pauseit==0)? copyspeed: 0
; x X# N9 }, g, i* Y; B" p! bvar iedom=document.all||document.getElementById9 O( e7 {" ]; O/ i% _+ s
if (iedom)8 k/ x% [4 `# y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 f+ ?$ C7 l) R, o
var actualwidth=''
5 L5 U' i Y2 R$ b- V' Z) dvar cross_marquee, ns_marquee
+ M, s2 n( Q) X" T3 N3 J; \5 X! Z9 J& L. `( d+ U6 j
function populate(){5 a" t" U6 F6 v' ? `; r
if (iedom){
$ c$ O# `" p& ?/ }cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! H- j- D- S$ I2 r; w. N
cross_marquee.style.left=marqueewidth+8
/ j% r8 f( G& g) }cross_marquee.innerHTML=marqueecontent
|. R1 u- G# S7 j2 Dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 v7 q7 K/ |* |, d D' N7 b
}
0 Y5 t6 ^4 C# Velse if (document.layers){. @, F3 h T# E& z
ns_marquee=document.ns_marquee.document.ns_marquee2) ^ X6 S/ C9 G$ j+ p; D
ns_marquee.left=marqueewidth+8
/ W0 p- R. u# u: t+ N A( z; o" ens_marquee.document.write(marqueecontent)
3 \$ A3 c9 i6 r0 J8 Vns_marquee.document.close()8 s" Q) a8 ^; w- K4 c2 M
actualwidth=ns_marquee.document.width; F7 }" V( n: ]- s+ F2 p6 _
}
/ z) b; Z- U; olefttime=setInterval("scrollmarquee()",20)$ H: z. b9 h/ N! v/ O- N
}2 N3 E3 m0 M# L/ ?- {9 n
window.onload=populate" C' s z. E: K9 M6 ]' E. C
' e" A$ [8 r9 ~# o$ ?4 k' J+ ]+ n! R
function scrollmarquee(){
) O: j1 M, L2 c4 {3 e: N0 F! qif (iedom){
4 Z0 n8 Q, i K3 T% r* w9 B+ Gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))9 }- f+ D. z8 z$ t
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 C# S. u' \/ }else
# k* m7 k9 W" n/ }* \cross_marquee.style.left=marqueewidth+8
6 j/ G% f, X: i4 L6 z( C
& S; L2 P( [8 v0 G* L}" B1 ]0 ^# ^" C
else if (document.layers){
/ t. P, t C2 j: m: Nif (ns_marquee.left>(actualwidth*(-1)+8)) f, Z! X" }* r
ns_marquee.left-=copyspeed
" B6 T. b5 t$ i: _- Y! _else7 Z& H) y; \3 K2 h" n9 R$ J8 z
ns_marquee.left=marqueewidth+80 Y8 \! \* b! F. F. M
}* [9 \+ x+ }7 _) J8 Z7 y
}: ]( D: b/ [! U
! u' O- X" f1 m: |# @; n
if (iedom||document.layers){
0 a; q3 G/ |! t. v ^6 j9 \: hwith (document){* `7 M) Z" {4 w" L4 V% L
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>') Q# o( p! L4 n2 Z" J" e" T
if (iedom){
0 c: g2 \$ `2 X5 k- Z4 [write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 r" {0 n1 D- y. H
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* N: t% V, R/ u( r& E o mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 T6 \ t/ N r$ ?; n
write('</div>'): I. B. ?7 {2 y% @: L6 s
}
) ~, C9 H' z' l! O: relse if (document.layers){' i. N" [# S: G' A! ?
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ Z- e* _7 ]* X. o7 d- ^" E* gwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" s% X4 k$ k4 Z$ r3 _7 k" r9 u# {write('</ilayer>')% x0 Q/ j6 ]4 i8 |+ F2 G n2 k
}
( @; s2 ?7 V& Bdocument.write('</td></table>')# J: ^$ S+ i" C8 r& n
}
% }3 _0 x/ U4 G+ [}
( J8 _) ?* G" r" q</script> |
|