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

|
网页之跑马灯文字特效
//修改宽度! J0 G* M5 F5 }3 Q& F3 L
var marqueewidth=300
! H, q2 K* @0 K9 u% j4 W//高度( ~+ D9 F! }8 X
var marqueeheight=25
; V2 @: A* v r% m2 i6 z( M. Z//速度(1-10); U( `0 M7 V, y2 a* [# C- G
var marqueespeed=3
* i# O, a" S2 D9 E//背景颜色5 L. s9 N) U. y% ^
var marqueebgcolor="#FFFFFF"
2 O7 F8 F# t# u+ E* e9 b% `//是否能暂停 (0=no. 1=yes)?
0 y! H6 c, o% lvar pauseit=1 L* E1 S' _+ x! x+ i. c
( l* D% Q' H9 B6 h4 w/ i. J4 {//修改显示内容# l& c( {7 v1 v: s" H$ J
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>', ]; z, W* w0 e/ R: }
4 a3 n5 c& E; a. N
" Z9 ^. u/ b0 s9 j0 P2 s////下面不需改变//////////// |! B! J& P; _+ D
& h; l# M) B+ V, S. T; }
var copyspeed=marqueespeed' s: {- w5 s2 l1 @
var pausespeed=(pauseit==0)? copyspeed: 0' N, Y: N, |" E' s
var iedom=document.all||document.getElementById
; \* ?* N) ^; p5 xif (iedom)) U8 Q; [3 h2 M: v- b
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ ?$ |& W: U; j0 |! r+ |6 uvar actualwidth=''$ D1 R4 Y+ |8 u% B0 O2 H4 s
var cross_marquee, ns_marquee W1 J7 P) e# X, s+ R' `# g+ j
) s2 H: D/ G$ ^( kfunction populate(){3 _2 E8 t* S6 J
if (iedom){+ ?9 b6 t$ x2 _+ w+ e
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 C+ ~% J# h5 l9 u3 l! s2 Lcross_marquee.style.left=marqueewidth+89 a G7 ]% N/ J* K2 {4 |6 b- x
cross_marquee.innerHTML=marqueecontent$ Z6 {1 C6 G. V7 T& h/ v
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: ^, j" g% m6 \ z* m# B1 t# j9 I}
' M" b8 o. Q3 s) Z4 K8 Melse if (document.layers){) d: q+ M. {# v
ns_marquee=document.ns_marquee.document.ns_marquee2; T- Q9 b n. h! p' L1 G
ns_marquee.left=marqueewidth+8
# ~8 ?9 n3 S! z% j7 Rns_marquee.document.write(marqueecontent)
. \2 M9 ?" G6 k; Qns_marquee.document.close()
2 H7 D1 Y- I5 @, P& |actualwidth=ns_marquee.document.width
; V5 i3 V& P+ V/ e; s}# D: ^- V \* K) L; @
lefttime=setInterval("scrollmarquee()",20)
- f$ [2 Y. |; c! @ ~}
( H/ j" b; q2 d0 wwindow.onload=populate
( p- E7 k! v& P) @% O P1 O! f3 D) ^( A% L) S; z* L
function scrollmarquee(){
( \- a2 `# Z/ J' L5 l! y1 h4 ^if (iedom){2 I0 y: u6 Y! S1 l% w1 }9 U
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
% Z+ R3 ?, O% B8 d- x& B r9 Icross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* F$ `: k; K/ U- y3 e
else
3 R( R! k1 s( a Z Icross_marquee.style.left=marqueewidth+8
6 \3 h" ]7 ^- ^" q4 J. r9 `3 }1 I/ M9 ?! f, j/ X- j' n/ ^
}
1 z: {7 y& w! K7 t3 H- Q2 }8 helse if (document.layers){- I( u' Y9 K7 n7 p N" s
if (ns_marquee.left>(actualwidth*(-1)+8))) M! v7 E8 r- R) z" C8 X
ns_marquee.left-=copyspeed
, K* g1 C' ^( n$ I- Delse
' ~0 U [, a2 B5 rns_marquee.left=marqueewidth+8; f- G: T1 g( A+ d' z
}
5 U! Y6 [5 x' d0 ~}
' @+ |, K0 [2 [# _5 g$ q/ w- ^& [9 h9 _, q6 @* V9 Z3 D
if (iedom||document.layers){
+ x; |) P7 ~3 Z0 @/ Kwith (document){
1 @/ v5 U8 d% \- ^# _/ ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! p& p! p% X* k8 E7 Y
if (iedom){
* ? M9 j3 ^ Z" O' f+ b6 uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" }- |$ n8 S* j+ j* i! Vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ H7 f+ a4 q' b) s3 @
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ `5 X6 g9 P8 B; v& i# Xwrite('</div>')
( b4 N* F2 J2 u/ `4 v) q}+ `+ u2 J% r) ^6 j7 ~" e: x
else if (document.layers){1 c7 c( [! X$ H% W, M$ s; f! n
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')9 `* |. Y0 s* N( A% j
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
& R% U7 ]2 {, bwrite('</ilayer>')
6 U' t5 L0 d2 O4 N! c. H( I! B: [}
) E) `$ \" W8 W" _1 Hdocument.write('</td></table>')( e' I/ K1 _/ E+ q
}
/ ]+ m# \) c5 N0 C1 [8 i2 [}
2 u4 n* \# c/ W6 }- z</script> |
|