返回列表 发帖

网页之跑马灯文字特效

//修改宽度& K/ X2 x/ E% v, U! O$ m! T; V
var marqueewidth=300, S6 b& ]& F. v, ^! N% N  M2 p, H
//高度
; X# b& p6 B/ P) |# B; D* yvar marqueeheight=25
2 W- Q5 u; Q5 z# p( N//速度(1-10)1 ^4 k: C$ z8 Z' ?4 M
var marqueespeed=3
1 O( ]; a) t- U" l0 a//背景颜色& E# p2 s2 C% ?- i: D; d5 q
var marqueebgcolor="#FFFFFF"# X% d6 J" l! I) b7 s
//是否能暂停 (0=no. 1=yes)?
8 [# {% H8 A! x5 W% fvar pauseit=1
+ D- `3 ]# x* l( l  u. ?# z. C
+ t% ^& w; \9 R( G//修改显示内容
3 M7 [% r* W, |: xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 N+ I- E% p: _( O
" K# j& x9 W5 ^4 P! F  \% I1 p& d, Y. Q4 x* d) d0 p/ ?0 f' K
////下面不需改变////////////: {: Z* d9 q6 `, g7 o" ?
% l% q# |5 M" p$ S& T& X
var copyspeed=marqueespeed& F8 a. y& \. h5 d1 ?' f+ i: g
var pausespeed=(pauseit==0)? copyspeed: 0. p) A. v+ j  \) H7 W5 ?. V
var iedom=document.all||document.getElementById
. w% u' w% T. n5 _9 R1 _% g6 uif (iedom)
! X. i' B* A; e% idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 @# a8 U6 n6 z# _var actualwidth=''
9 o- R2 n* ~6 n2 c- ~; w& o  P1 t' l# rvar cross_marquee, ns_marquee6 Q6 p6 D: F7 F

6 l6 P7 F3 F  G1 j; c/ {) Sfunction populate(){0 ~" B& k. ]: M9 j% }% v2 B
if (iedom){* L! ~& G' D! Z' T0 e& C5 }' n
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 k- g; s. c- k9 S7 b" F& pcross_marquee.style.left=marqueewidth+8
6 C2 I7 n9 A3 [4 q' K5 A. U$ [9 Kcross_marquee.innerHTML=marqueecontent
" z/ O! N" z! T$ f2 M9 Pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" L8 }0 \6 r" M: O& b0 Z
}
/ D8 h+ Y, J) A: X: eelse if (document.layers){5 ?& W8 K9 E0 Q2 d5 D
ns_marquee=document.ns_marquee.document.ns_marquee2
& r+ Y" ^2 a8 F8 ^, S0 Gns_marquee.left=marqueewidth+8$ F' ]/ A) P" Q6 Z3 ?8 a
ns_marquee.document.write(marqueecontent)
$ a* |  [+ j. V* f3 K8 a% t# Kns_marquee.document.close()
# I1 h' M- F+ A- Aactualwidth=ns_marquee.document.width
4 x5 F, _8 d1 u}, v; r! s! L. @& D
lefttime=setInterval("scrollmarquee()",20)
% J/ ?$ C' P, v4 Y& D4 v5 [}
5 o! H$ H" p3 X/ d& `window.onload=populate
) \' _, ]7 y; y% T( G$ a$ X# @" F5 A  f6 E- e$ O# T/ f" [7 e/ e5 ^1 K
function scrollmarquee(){
+ ?5 x/ W; t( Wif (iedom){) ^$ H" @8 |. W& S: S9 F; l( r
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 T0 g! M' a; c3 `4 `cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed1 q" [4 z/ p5 g% R) f8 D
else
& a% u  \) `! t; b; ^cross_marquee.style.left=marqueewidth+8
1 T5 F+ o/ v- E; T4 ?$ e8 T
1 @2 }) k- [/ z: b}$ }: I$ |4 H2 Z1 R7 N7 @
else if (document.layers){
' j8 d5 v" u3 yif (ns_marquee.left>(actualwidth*(-1)+8))% e" D! K$ \% S, y4 ~
ns_marquee.left-=copyspeed
  N) ~+ i" L% A% }else" l0 }8 j7 O0 R/ s& B4 X
ns_marquee.left=marqueewidth+8. l5 r. ]/ E: p7 A! q/ n. E1 ]5 j
}! K$ [$ i0 o+ C
}2 ^8 P2 |& J3 F6 d! S: j; j5 g& X

7 e2 R  ?8 Y: H# L: A' U% ~2 N# Aif (iedom||document.layers){
7 \) S# S  w5 {4 K7 Y+ b! Awith (document){
6 U( Z* M% {, s4 C' G/ M$ }5 }% Jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 `. g+ w6 U2 A4 y. ~( t  iif (iedom){
# p& N( Q# {0 E6 T( a2 cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')/ `" Z# R& l/ z1 _, Y' I) ^
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) r% ?! H* b( S% g% U& }" F- vwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- i  D! Y$ ^( V+ s/ _
write('</div>'): B' U3 H! K9 a2 \
}2 S" ^( R- J& x$ y+ n. _: Z
else if (document.layers){: F% O$ h# J- B5 Y( r
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')0 b0 o5 H: s8 `; p8 p5 W1 Y  f/ _8 |& J
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' C( Q8 i9 ~/ p$ ^+ u0 j& ?& a
write('</ilayer>')
) P' }/ W2 i7 [1 c9 Q7 x4 b1 }}/ G; A4 J" [: o; h; M4 r5 M# {
document.write('</td></table>')
' z* L9 z+ o1 V}
! m- B6 V' m# u8 e+ F}" H, `5 C. ?0 X' Z- G+ U* L
</script>

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