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

|
网页之跑马灯文字特效
//修改宽度
9 }/ A# ]6 f3 P* h" G, |var marqueewidth=300
3 u, m8 I0 a A0 j//高度. f' v: u7 P+ A3 p1 J. p' c
var marqueeheight=25
8 ~+ O6 R/ I* H8 M//速度(1-10)' z9 a% Z6 F! f9 D8 B
var marqueespeed=31 Y2 o C- u7 j
//背景颜色! l4 S+ n3 L1 e- K" |) k$ Y0 l
var marqueebgcolor="#FFFFFF"
- e3 w+ e1 J+ R3 N1 d/ ]% q//是否能暂停 (0=no. 1=yes)?
+ k- Q: r" O n/ o( N% `% Z: dvar pauseit=1" n& Q% ^* v$ T- F% h
; G+ o4 z) a" s0 h4 a% ?" N- q//修改显示内容
( k: ~, Q _+ F: L. z8 s. L9 Jvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 V, }5 ]9 k8 U3 [4 {; R- w; _- ~! ]3 l
! Z' i8 ]& n: d/ F) q6 e# x; m: \ }$ A) L5 L
////下面不需改变////////////
5 q+ Z; ~% a4 h" |8 v% [1 K+ _& J3 w Z* O6 J; ]# ^2 @; b
var copyspeed=marqueespeed3 V# m; g9 v8 M, _! K
var pausespeed=(pauseit==0)? copyspeed: 0# b6 q G8 ~, Q6 h$ r0 F: Z
var iedom=document.all||document.getElementById8 i# y z1 p3 F7 ]( p& B
if (iedom)
1 K6 `5 ]9 k) g; q* H8 j4 ~document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 ?. f S2 U- {/ L; u: N
var actualwidth=''/ x2 [" l$ e; o/ P4 i* J1 G
var cross_marquee, ns_marquee; U1 y1 Z# e3 W g% n0 y
0 `' b- _( f N1 ]4 Q) Nfunction populate(){& ~7 l: ]+ z6 A6 Y0 O$ @8 |
if (iedom){3 l& J2 A2 C0 s; z8 R. W% g
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
% w! e# g. E# ?. Icross_marquee.style.left=marqueewidth+80 W/ r! s6 g2 v; a; i4 h& c
cross_marquee.innerHTML=marqueecontent u5 o' H; s5 \9 y( X
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: m+ z5 _4 k% k+ P! k# Q! S1 G
}
, a- R$ K8 g$ T* E; k5 Uelse if (document.layers){/ O* T3 Z7 Z Z9 Z0 [5 G( C% n4 R
ns_marquee=document.ns_marquee.document.ns_marquee2. K+ y0 m2 V8 _9 G
ns_marquee.left=marqueewidth+8
) E9 v$ w' ^! _- Fns_marquee.document.write(marqueecontent)8 H) {! Z: h# S
ns_marquee.document.close()
& C \$ D8 n' \4 z; v/ bactualwidth=ns_marquee.document.width
3 j6 G; V2 f7 X* {}
+ \* ?: a* s* p( \, y0 M; llefttime=setInterval("scrollmarquee()",20)
L3 Q3 q& c/ R2 T, x! X$ H* H8 a}
" j' k* V* s5 t/ A4 ~! }4 Gwindow.onload=populate, n; w8 |( Y4 h& a8 X
; E$ g/ b( p; \* ?function scrollmarquee(){
. A% b1 X; I- X9 m/ F) bif (iedom){0 L" G+ {8 ?7 U
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
% Z9 S5 V% s4 |- I% Xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: x5 ]- h) G1 a2 k& H V' Z: n
else
, k z7 `0 I0 {' icross_marquee.style.left=marqueewidth+82 b+ y" B. G4 J; q
) Y/ g8 l5 R; R5 p
}
G; T. |1 v4 r n; c8 u- f. _! n, kelse if (document.layers){- L$ \$ _4 S: B6 y9 }
if (ns_marquee.left>(actualwidth*(-1)+8))9 [5 ~, {7 @4 Y! }. Y" e
ns_marquee.left-=copyspeed& \7 {/ ]# \3 M$ A+ m# A) e, a
else
- z/ Z) f0 I6 P. H7 y: Xns_marquee.left=marqueewidth+85 \1 H* ^1 A8 d
}* Z9 q* ^& Y9 E) F# \/ L
} w. K8 p* _/ m1 u7 _
5 O# J. ~- r" j
if (iedom||document.layers){
- {8 {- I5 _: T* d" Awith (document){" X6 I& _8 \9 ^2 h: V2 r
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 ~8 B F3 O' M* }# Yif (iedom){
5 g0 |6 F5 @0 y1 }1 w9 |write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! i6 d9 r8 M! m4 ?: j; ]" P
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 U& S o- ?% owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')) n, @' G5 y) r5 m8 ^
write('</div>')7 [7 C: d' u" o7 D5 w9 r
}
3 l u: B) M! velse if (document.layers){
0 h: F4 M3 q7 p' vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% F: V0 P, C& x/ h3 t
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) p7 }* {. X' c9 s
write('</ilayer>')' M7 Q* c/ s3 n* N6 h' v8 p7 c
}! P& K8 C6 I9 ?( b; }8 X4 X
document.write('</td></table>')
9 y1 w# |! Z+ T}
0 r7 U1 b1 _- G! d" g5 M}3 r$ @8 }5 b! |4 r$ q, l4 D
</script> |
|