获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度
$ R2 V8 |, M' H( L( Dvar marqueewidth=300
+ e0 M0 n6 d# Y+ y% U. L9 J//高度
5 c4 T* ^2 s, M' pvar marqueeheight=25
. B6 B7 F& U: y* F& k" t$ i$ O' Z9 t//速度(1-10)
0 ]* z+ g; W8 f! n! T: k: d" Svar marqueespeed=33 L* |- T3 P3 o7 I* D0 l
//背景颜色
% T. g& j& G6 {% Rvar marqueebgcolor="#FFFFFF". R8 j6 n/ l" C5 @: Z  j
//是否能暂停 (0=no. 1=yes)?3 {. Y. v+ t1 s
var pauseit=1, C$ @; S# [0 f! ?6 \4 z4 @

  W9 ?3 ^6 h0 m, i//修改显示内容
4 j& q; p/ G5 ?var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& n$ t0 l/ `7 c: r0 \: `: q: F$ ^$ a4 n$ W0 w1 x: h

, F8 `2 A% i8 ]$ ^" `% V////下面不需改变////////////: a  w, g- P6 T2 ]7 \2 G$ r0 `

! t9 U4 W4 H! e' {+ G2 j; Gvar copyspeed=marqueespeed) }. |) M" B; ]8 ~
var pausespeed=(pauseit==0)? copyspeed: 0
: C6 O9 P+ j' B+ i+ Fvar iedom=document.all||document.getElementById- C3 m8 ^8 {; a, [" ^
if (iedom)
: M/ ?6 M) x; j  I( c# N- o. gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ d1 H/ Y% W. ]$ |' X7 N  ?var actualwidth=''9 ], l" U# x4 v: J' ~2 g3 a# A
var cross_marquee, ns_marquee4 V  z5 u6 r- k, f. e0 x3 @
" `* _! G! ~4 S( R% o2 ?- m8 q
function populate(){8 o8 Q- U2 P5 {3 \2 A( s! [/ V
if (iedom){
' ?) r) X: s0 Qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
" D' `/ I5 b2 ~% T* I( d: n- wcross_marquee.style.left=marqueewidth+8
4 }! d" I4 f' y% I) u' @cross_marquee.innerHTML=marqueecontent' r$ K! V/ d: ?. x9 W0 U/ p7 A, ?
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
4 h2 g  q+ D8 r' x}2 R4 |4 a* y7 X0 |! v* H
else if (document.layers){% F2 a& f  j9 f
ns_marquee=document.ns_marquee.document.ns_marquee2
7 Z0 J5 w) r% o# @ns_marquee.left=marqueewidth+8
( r- w9 c# P  ens_marquee.document.write(marqueecontent)
% X! L4 \# F, C- o2 I: @& xns_marquee.document.close()- P/ n( Z1 B6 l# D& h! `! D5 @. r4 w
actualwidth=ns_marquee.document.width
2 M  m  q7 V6 b. ?# `}
5 c( l# I( a; u" p3 xlefttime=setInterval("scrollmarquee()",20)% @) g4 t7 J- j
}( q- g2 A- R% z: o, j
window.onload=populate
" \9 M% i/ f9 s
1 E" w: ?7 ]' E. d* C; Y& y+ @9 ^function scrollmarquee(){
0 |& p  C. f* V: C" ?1 _! ]' uif (iedom){: o# L' ~9 |) d' t0 E
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 U$ _" T7 y2 n2 M2 B4 ~; r
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed0 |+ h. x( k% |2 }4 q7 h
else
& v2 T/ r& ], across_marquee.style.left=marqueewidth+8
5 o0 e& b! Y* U! p) ?. C' A
7 ~! Y  k! v* h( ]) |}
+ m9 _7 I: V" M5 Y- l# G) L! Aelse if (document.layers){
" c: f: j2 W/ g2 S6 |1 \" Z9 \if (ns_marquee.left>(actualwidth*(-1)+8))
7 n; f( K) ]! ], qns_marquee.left-=copyspeed
& w0 [& f: P7 l$ w: aelse
0 }! Q2 _% j2 q, b0 a$ B+ Fns_marquee.left=marqueewidth+8
) D- U3 \4 V' C2 @8 L; L/ p}! j; G5 F! ?0 D7 [, J; U
}6 I( v) T3 x+ q$ ?2 ]
& W; F: s, a& H! C9 x" {
if (iedom||document.layers){6 p8 X* _8 S4 s( Z2 _6 r3 ]4 H
with (document){& p3 l3 k& f  w5 p4 v" C2 `
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) Y* L7 b' \. a% g, u* e$ `* s& K
if (iedom){
8 B+ h+ Z; b1 z8 a% @write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" r, E/ |; ^  Q$ d9 S# s  fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) j/ Y2 d9 D/ N* K$ nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: r  i- z0 Q; R9 M- [write('</div>')
4 E3 J0 @" j; {$ ~}7 z4 ^6 z! G8 B' h* ~1 \
else if (document.layers){& v0 Y7 Y$ J3 c, M" }0 q
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ l6 X, W, @% h7 Vwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( R( [5 F8 s: z0 w( Iwrite('</ilayer>')
0 T5 l& n( b, k' g}+ ?0 _5 p. S5 @4 Z' G, {! S, A
document.write('</td></table>')
: z! R. P; C6 Y) F}* J6 j) f5 V# b
}$ [% C* F/ d+ n2 g# _
</script>

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