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

|
网页之跑马灯文字特效
//修改宽度
0 Z2 M7 r. ?9 H& ~" I' i% Y* Evar marqueewidth=300
9 M& L1 |1 n, I//高度, O2 k9 t: T& z5 I4 J. E
var marqueeheight=25' a0 r2 A0 d% ?7 H! N- i
//速度(1-10)
, a9 C; Y$ w$ v! \: Lvar marqueespeed=34 l0 z0 J1 ]; ?1 h; z$ S& }1 c
//背景颜色
$ J+ I* z: m8 z9 u# Pvar marqueebgcolor="#FFFFFF"1 ?6 o) E8 s' C+ a! J/ W0 ~4 t# A; z) z
//是否能暂停 (0=no. 1=yes)?! O" l5 p! {- ?5 z& Q
var pauseit=1) J0 Y. I( O/ Q& n
1 R6 |. a5 K* N n, b//修改显示内容
' j1 I2 i7 l+ mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- z: ^* b3 N; X9 e6 v
4 Z9 s6 P" G! c5 j2 o7 i! r
' N' X; v: L" N
////下面不需改变////////////: U% t6 A8 ]3 N3 r: A- b' X
, O9 l. V4 c! d0 |8 f7 svar copyspeed=marqueespeed* J* f/ r; {* ]
var pausespeed=(pauseit==0)? copyspeed: 0& Z' V4 Z* k3 h9 y' v
var iedom=document.all||document.getElementById" M* h$ ^* |3 P/ T7 b6 \! i
if (iedom)$ o; a5 m" n" h1 e
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; _, x% t* B& w, q/ N! }var actualwidth=''
0 ^9 G6 Y( m8 ~# wvar cross_marquee, ns_marquee
5 s0 t8 A: D: v3 N& C \) h
% J# s H+ h9 d5 Jfunction populate(){
# h: z( b, h+ Z( @" `) Jif (iedom){1 V/ U4 ]1 B, n6 Y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 z6 f5 e. L8 G }0 Hcross_marquee.style.left=marqueewidth+8
# X) U8 s, e% L8 ]( icross_marquee.innerHTML=marqueecontent
( n8 v \6 e; d! m1 |actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth/ ^! W/ T( f" a" W' O
}
m3 w( Y$ ?, |3 R3 y# }% Kelse if (document.layers){) H! }$ J) q& t* ^" L8 ~. ^* b
ns_marquee=document.ns_marquee.document.ns_marquee2
. G* }! r: \, `% [ns_marquee.left=marqueewidth+8
. U/ y+ r, M8 k- y. ~- l& ?* Tns_marquee.document.write(marqueecontent)
3 I* }- N* A1 Sns_marquee.document.close()" l g. ]% v2 x* o# _
actualwidth=ns_marquee.document.width
3 N/ z, g A) z; \}/ J% N3 z5 Z# |/ y7 \
lefttime=setInterval("scrollmarquee()",20)
% c5 U# I& n* p9 P}
" e1 i' a8 R4 f4 K' t# jwindow.onload=populate
. w4 y+ p; Z" ~9 t- z: u# Q4 A# _, D5 _' y; D! p4 N
function scrollmarquee(){' C+ |5 J3 h4 X0 c. m/ U+ p1 w
if (iedom){7 h4 l7 y# ]4 {6 O6 o9 \
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 y D) K+ l5 V( B+ X* R, w) t
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: l) c( y# x7 f. n1 N( Qelse
: p+ ~+ ]3 n, x- h; F {# ~6 m/ \cross_marquee.style.left=marqueewidth+8! J5 X* ~/ t& x
. A/ X2 @( f7 K8 s$ ?}
8 Y# J: z' C' G# h; O- }* J% v velse if (document.layers){
2 s8 e, w( B: ?6 {7 u' g1 e# iif (ns_marquee.left>(actualwidth*(-1)+8))5 l% j6 ~6 Q. a6 M7 P) F2 A* e$ O
ns_marquee.left-=copyspeed
) D- a; ~- ]9 P! gelse! a3 {! ^( d3 v% ~* u5 z) ]; {
ns_marquee.left=marqueewidth+84 b h& `: L( r2 B4 B
}) q# ]6 b6 }1 u7 S' N
}
. v B0 e- T+ z. q) |
: \% m* T, G& @5 A3 y7 hif (iedom||document.layers){# c/ I( T: N( z0 _+ J) C
with (document){
1 Z c) H# V% G8 k( @document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 ]; ^8 `: h; m @- o7 o/ }if (iedom){
7 @) i( g) ]6 \6 u) W0 N( V, Wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 |3 z" f# m0 `1 e9 K b; t9 mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')! K" n; p' v; d4 J' \8 {
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" W, N# x+ m/ x
write('</div>')% L# u3 ]" x# Y) N+ m1 H: g& X
}1 I' A7 m/ Y7 H* T! G
else if (document.layers){
X; f. [. V$ e3 d- f3 Zwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 M" z2 k, x9 h9 q: a: `) owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" r$ q8 N) Z0 ~write('</ilayer>')
* s) x2 _8 f9 X}- {. J& |1 {: F. S( R W& n
document.write('</td></table>')6 U% M$ |3 J1 q+ T6 \( r& S$ p9 q
}$ l' ]$ U; J, A9 Y
}
' V# k9 \, D6 R; @</script> |
|