返回列表 发帖

网页之跑马灯文字特效

//修改宽度: @) w3 f+ d1 y
var marqueewidth=300, C. s) y8 c& m- H1 i/ w
//高度
6 c* W) K7 c( y. U2 kvar marqueeheight=25
9 ]3 D+ \. U. o) C- Q# G: G9 w2 A//速度(1-10)( x) ^. S# ?/ G# [5 R4 a6 r' F
var marqueespeed=35 e1 m( {( B! i/ {0 K
//背景颜色
. K  G/ R4 a5 o( k5 P( f+ avar marqueebgcolor="#FFFFFF"$ L0 K3 w/ ^% R/ T9 R% b
//是否能暂停 (0=no. 1=yes)?
" O/ E7 r% |# s7 o5 q8 @8 A8 Bvar pauseit=1
3 U4 E6 F( J" r3 N/ I$ m8 S2 @3 T1 P/ U4 R/ M/ r' B' p4 I" d& x
//修改显示内容/ \/ h8 H" D- r$ e9 S. g# I
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'  Y4 W, r" @( q  I$ u1 P! \

* A7 U6 |0 z/ j' H( p2 [7 `
5 ^7 e0 @  z, k9 }////下面不需改变////////////
8 o2 y, N. N( j
; `: M' K+ n0 g1 Z' z4 e* T, ivar copyspeed=marqueespeed# H, B& b# L* R; x6 x5 M- \4 B
var pausespeed=(pauseit==0)? copyspeed: 0
$ o# r, M/ N7 X* J3 o+ evar iedom=document.all||document.getElementById1 _" A! v  M) C+ g1 N  L0 F
if (iedom)
9 G+ x, c: ]; ]0 R& ~9 d- r% cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 K3 J. D2 C3 z4 H3 w/ z- Yvar actualwidth=''5 O! T& T) l9 e' U" J5 O
var cross_marquee, ns_marquee& }$ z4 n! @/ W7 _6 H1 V
  r# v2 p3 u" [% O
function populate(){  Y1 m, W. Q) _3 C7 ]6 T/ Z
if (iedom){
: V$ `" t; [% R; K5 v4 Xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. A% H4 I2 h1 r% ^( f
cross_marquee.style.left=marqueewidth+8: j+ Y4 H( A0 G) e2 V0 G
cross_marquee.innerHTML=marqueecontent+ U+ O% n7 T0 B. `
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 ]" W! |3 h- G0 T3 z
}
/ t" L1 i+ t7 W! c' Oelse if (document.layers){; j: i) r9 J2 `" f$ W+ D
ns_marquee=document.ns_marquee.document.ns_marquee2
+ w# K2 z" v" ens_marquee.left=marqueewidth+8
3 }6 I7 s% h6 g( T" d- d3 O$ I, cns_marquee.document.write(marqueecontent)
$ z/ {4 }9 I4 @6 f$ p; H! |6 @ns_marquee.document.close()1 j: V$ j5 n! P; J5 n
actualwidth=ns_marquee.document.width' [) [) T. Z0 g, q7 |
}! _; R! K8 `- @4 e2 Z  s! q# c/ @
lefttime=setInterval("scrollmarquee()",20)" l) t  M1 Q* `
}& Q3 o$ J, v9 w; }' T8 u: q8 k
window.onload=populate7 a; J8 u8 q: U# i3 I$ `/ _

9 |- _4 V& ^* q3 j- n) yfunction scrollmarquee(){% ?" R: Y9 {$ C' G+ l0 I
if (iedom){% n: L' A0 b. L
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 x4 f' ]  H0 _0 N) j! s) fcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. K2 }/ z  g3 }' ~% F/ R0 u, k3 {
else% w' O; G# [* v% w* n% u
cross_marquee.style.left=marqueewidth+80 k% m) E- o$ P% Y' s
* k5 Y/ G1 Z: C6 U  P2 z; L
}) x/ Y3 \6 v& ?; O) y4 \: ]' `
else if (document.layers){
( r1 A$ ~2 o) N& t$ Kif (ns_marquee.left>(actualwidth*(-1)+8))
2 y0 v) ]; Y! Z& t* P% w) E: nns_marquee.left-=copyspeed
2 C# Q0 O( L% V: U" v7 ?else2 a9 \" @$ u7 G- Z+ j: |
ns_marquee.left=marqueewidth+8- N: e, L5 ]' B+ o9 N6 G
}# `! P+ ]; n# V+ V5 a8 w
}  {0 b: \2 v( c9 j7 y6 a- m8 V

. n/ e) x% w3 o; Cif (iedom||document.layers){( \: }9 H  T- e& P
with (document){2 v; Z  u- X" [. B; q+ I2 a7 _
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 E3 L( ]9 d0 y2 L6 X
if (iedom){9 @1 y' H2 ~6 m
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')3 ]0 A0 T9 }; |
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& S% b" \3 v1 u* C0 P$ U2 n- P; y
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
2 I) E: m. }, p. f, j$ o) Jwrite('</div>')' J  U$ J% q. ?" Q/ {% y
}: @, p# {  u3 Z3 ~8 d( s
else if (document.layers){& ?! ^% s, o% Z! Y
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 p& m7 e8 T. [1 @+ r
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). E9 f3 V8 G$ f. x; V
write('</ilayer>')
) r9 S& g' s# Y4 t8 O}; j3 }& ?2 s) f( k, u; G' j
document.write('</td></table>')- b: `, F% H9 p
}( O9 q$ W" T5 w0 @, n# Z* b
}2 D: U; s' r! x2 c4 m( g; z
</script>

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