返回列表 发帖

网页之跑马灯文字特效

//修改宽度, s9 |0 r2 g  B% j7 r) j) P5 \; ^
var marqueewidth=300* A7 q9 E. i6 x
//高度- S( }9 N1 m0 f
var marqueeheight=25
8 I$ k$ F5 Z* q# Y7 y//速度(1-10)
: X+ _4 z0 j% X0 z9 j9 @var marqueespeed=3% c9 w0 P6 L% n+ ]' M( l, R
//背景颜色
' R1 f( G+ ?9 k+ Avar marqueebgcolor="#FFFFFF"
4 Z; R5 P4 o3 L0 c7 D- q2 s//是否能暂停 (0=no. 1=yes)?
; J* c1 a) J* N* T& C, Ivar pauseit=17 h. @8 g$ k* g+ n3 |
* G7 n9 i- {4 ~5 ?7 x2 A
//修改显示内容
0 \. K; S7 ]4 k4 G. o* J# Q3 Xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'$ Y1 {5 ]- v9 j5 n

% z5 }! c" L( Z1 V: y9 W  k6 f1 s9 j2 a2 O, N7 X) V
////下面不需改变////////////
9 X5 i0 m, K& @9 g
: `" K7 s( T7 p- ^/ ~var copyspeed=marqueespeed
8 a- Q& j+ i* b/ U8 h9 Ivar pausespeed=(pauseit==0)? copyspeed: 0  G  s6 z0 t& c8 S! \! p
var iedom=document.all||document.getElementById# B6 x7 i& L2 ~7 n! a
if (iedom)5 k1 I/ k% d$ t% }
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" F4 N* G5 a0 |  f/ I; m
var actualwidth=''
' O% W7 \/ q' Z. [% I, Ivar cross_marquee, ns_marquee! W( c! W$ W+ c, K5 G. w
  c, _6 q& W; w: V& @
function populate(){, t2 `6 W# a' a" ?
if (iedom){+ @5 o* \6 X4 n- B& O, v( ]
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( s9 P- d. i2 p" D
cross_marquee.style.left=marqueewidth+8: |2 a: w9 @7 x' Y  z3 B
cross_marquee.innerHTML=marqueecontent( s2 U2 |+ i; @9 v1 F1 {
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) ?+ [& C: R1 p) k
}3 t% T( A5 n: @+ ~( V! o
else if (document.layers){
% j2 k  W8 @  }! Zns_marquee=document.ns_marquee.document.ns_marquee2! `5 y: H; U1 ~9 q7 X/ p+ N/ c
ns_marquee.left=marqueewidth+8, m; V# b- J! Q
ns_marquee.document.write(marqueecontent)$ c6 n0 f: _7 _0 S
ns_marquee.document.close()
% }' C) S0 l7 }8 \actualwidth=ns_marquee.document.width
6 q. ^. d: Z: Z# B. m& [}8 J2 y0 _* X% B; O5 Q3 U
lefttime=setInterval("scrollmarquee()",20); j. F) ^: m- G" f
}  i) U/ }6 S6 W- `( L0 c) Y* n
window.onload=populate5 A8 l6 I- R2 d- V; e7 r
$ I) Y( \- k9 o% L- t
function scrollmarquee(){/ y4 E, q) O0 Z
if (iedom){& ^4 E0 u( A1 |2 c, e
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))9 e, D. u, g7 j$ j
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 G! c  N% f0 x" `5 i
else
) X. Y, w$ x( S* y- @cross_marquee.style.left=marqueewidth+8
0 E1 U0 w" H: P7 E- R2 G% [* m! A) F
}" m0 U3 r& g" e, E+ j5 g
else if (document.layers){( i3 ]# X$ q1 Q0 r
if (ns_marquee.left>(actualwidth*(-1)+8))- q9 B0 F! ~% ~9 }1 h
ns_marquee.left-=copyspeed) P: x( ~# d& w; G2 Z1 \7 n5 v
else% b& R# m) W* t1 t* y+ F  r
ns_marquee.left=marqueewidth+8
4 W% n& @, O6 E, Y" @& m' J}7 v. ]; U! X% t& F5 p+ S5 \
}
% o/ n6 ?8 u* f9 T# R9 L0 l2 K
! y; R; c  x1 @* P, Iif (iedom||document.layers){
6 q& X: f: b4 Wwith (document){6 X+ A% l/ s" k/ o/ K8 U
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 X4 f4 r* m* V0 s( N  Lif (iedom){) Y. g2 q" w& e' I; s# V, a6 b! t+ b
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ b# i8 a- T. j7 c3 zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% s" \1 m# s1 |3 s
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- t6 [( x. S: l1 [
write('</div>')
" w6 d& u3 F( e) c}
' ~  S9 K. V' q$ l  M$ i' R% ?3 Y& belse if (document.layers){
+ L" U6 g7 }+ {) Vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( }% O1 x3 |* `* ^; f
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. O' e3 B6 p# v  ?: p7 Twrite('</ilayer>')* Z( b! ~4 Z( h; a- ~2 g% J0 E. p' t/ F
}: Q- _% ~, x1 \4 @" I
document.write('</td></table>')6 K# Y- Q4 c$ e
}
. N9 }) ]# {6 q. `* ~- `- Q}
- v9 a5 n- a" y: Y- T" M5 [</script>

返回列表
【捌玖网络】已经运行: