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

|
网页之跑马灯文字特效
//修改宽度
; S& G0 {/ L0 q( h& p; r. @var marqueewidth=300. s; W$ j1 w; P6 Z) ^/ p: S
//高度
# ]4 e5 M: B) L8 G: Yvar marqueeheight=258 X' f) H2 R" j5 P; j$ @0 r
//速度(1-10)( E: p4 g3 A7 ~/ X- j
var marqueespeed=3
2 @: y K. F1 L! X//背景颜色( f- E: m" }5 N( \9 M
var marqueebgcolor="#FFFFFF"
. e5 m0 `0 G. R0 j( R+ g) E- b; ]) E//是否能暂停 (0=no. 1=yes)?
( n) `$ Y) r2 \0 v4 `var pauseit=1; L8 g5 i5 [" T$ \) k
/ E3 r1 O+ P1 V2 J8 u! I//修改显示内容
, S2 t) z3 X0 g: b; ]3 m7 ?2 w+ ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
4 f4 ]1 b- H7 U R+ W& F+ C3 a4 A
7 d1 l [$ Q- i$ i3 O: F( |
6 H' q- W& M: s2 `////下面不需改变////////////& @$ t4 S+ I! W2 i! ?9 c
6 Z, x {9 I9 {/ m/ e: _var copyspeed=marqueespeed$ I* z+ }( x% |# v7 `
var pausespeed=(pauseit==0)? copyspeed: 0
( Z# U9 ?/ G" U+ L9 p T- c8 hvar iedom=document.all||document.getElementById
- d0 I- f2 Q; }: Kif (iedom)
/ C% w2 R9 K7 I8 W, [1 Qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" O" ^3 }, ]; k3 q T& A
var actualwidth=''
3 ?5 O& j8 A& j& V Z: |var cross_marquee, ns_marquee
, `: a( L: q' z* |- ~$ F. N$ @3 ^+ p- L( s0 ]' @
function populate(){0 |) t# V; s5 i; K
if (iedom){
/ n! F9 ]2 P; q* w: Z# C; Vcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
. {! ^7 D& @, H, \( U" mcross_marquee.style.left=marqueewidth+83 M" J x( B, z% n' I; q+ X! A6 C
cross_marquee.innerHTML=marqueecontent
2 O* y) H+ b/ f& K" M" c2 {actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth/ S. c! v( }8 i9 S+ I8 k ~+ V
}
5 p0 X3 q$ \# n3 Helse if (document.layers){4 g1 c+ f: q6 a4 m* L
ns_marquee=document.ns_marquee.document.ns_marquee2# q2 l, }8 b% l& u5 L
ns_marquee.left=marqueewidth+8
' b. i4 l6 h/ U2 o+ lns_marquee.document.write(marqueecontent)
5 A; | z+ K! _3 B9 }) E: xns_marquee.document.close()! \9 G; I6 e5 n. B/ G
actualwidth=ns_marquee.document.width! m8 x/ I6 N8 [! T/ f/ [ ^
}! ~& U$ N1 {7 Y4 Y5 D( O1 ^1 }6 D/ Z
lefttime=setInterval("scrollmarquee()",20)
6 z) a3 g4 p0 J! Y}
7 ~7 K4 u2 e c0 iwindow.onload=populate
% H/ L( B" {% g* x6 L8 [( \ d2 ^& w' {
function scrollmarquee(){6 f2 F; l- \' i9 o! F. C
if (iedom){9 T8 N* \# t8 ]- B7 E/ g
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# Y7 X6 [4 E% _! [
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* s# [' a& X$ j; {# q1 E, ^else
+ q9 T" \# }4 K Q; K" f2 Gcross_marquee.style.left=marqueewidth+8
6 ~3 k+ x8 c, ]- L6 L! Y7 w- z% z7 k* [' W; `5 v/ W2 v: P! I Z5 }
}! w/ J6 B; i8 U z) f
else if (document.layers){0 h) G3 c3 ?% p& l
if (ns_marquee.left>(actualwidth*(-1)+8))$ i; ~3 B3 r( I4 O+ H
ns_marquee.left-=copyspeed: j! ]# R# ~1 x% J
else
$ s4 v8 X2 |- X: X3 Nns_marquee.left=marqueewidth+8
5 t0 ]+ i) p" K' L) ?, n9 h}8 K* s$ J+ c3 J, _! c, {
}
" L* l0 g* D; ? a: |- _
1 x7 k6 _4 K6 w9 ]6 Lif (iedom||document.layers){
2 {; U) p% y" I/ M# z6 F- ~+ jwith (document){
4 W/ ^6 _7 ^3 ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
A5 B5 E( n0 k8 w% T" I, pif (iedom){
& b& Z) c- Z. q- N5 fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* g1 v. s# `. T! p0 [: f
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- a" v7 ] J9 @& d: a0 {write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
# A# V" G6 g+ }6 u, M( j" P% jwrite('</div>')# | H" B: F, m% @7 l
}- m, s4 E2 b4 s0 [1 T( O5 s
else if (document.layers){& i7 s! y# h6 w( y* h9 Q& H( x$ s
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! c+ {6 b+ \! O3 R$ Awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 A8 P. Y( E$ F& m% f
write('</ilayer>')6 u" }( T# `+ o$ U3 k
}
Y) _3 a) n$ }% e$ c Ddocument.write('</td></table>'). Z! H/ t: j, U- }3 I
}8 J& x; x l R/ F7 S
}
! Z/ L0 _- w$ r* w" J</script> |
|