返回列表 发帖

网页之跑马灯文字特效

//修改宽度2 \) T6 ]( ~! A6 ~
var marqueewidth=300# N5 O. P% L1 J; |" \0 g; }% O# `* ?4 J
//高度
+ z) ]' v, o; @: _var marqueeheight=25
! g3 N% F1 Z" n  h( T, `//速度(1-10)
9 w' _$ T4 C" t1 l' Hvar marqueespeed=39 |; [& l# ^$ o
//背景颜色
6 o; b# e# z2 q3 z: svar marqueebgcolor="#FFFFFF", R: o0 k! E0 t! a% t0 T: m) B# l
//是否能暂停 (0=no. 1=yes)?
: m) l) S0 P# \* f( ^4 mvar pauseit=1# j( Q; v. ?9 Q2 S% z+ R3 d) i

0 w1 m: G4 e; a: |" W* {# C//修改显示内容
' v: d  p/ j2 y2 Tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 n& A) h/ N! s4 c

5 d+ [& L  T+ }  S- P) K' k2 ]6 Y( _. E/ ]
////下面不需改变////////////
  a6 m$ C" m( X4 t' @9 _
7 W3 p. Y: \9 R" H0 l/ R' P0 Qvar copyspeed=marqueespeed$ Y7 O! t0 z2 a
var pausespeed=(pauseit==0)? copyspeed: 0! Y  \) ^; D. G2 A& b% Z
var iedom=document.all||document.getElementById
6 l, P& g7 E# R( dif (iedom)
5 r" \0 l0 t% g+ W+ ~! I/ E/ R& sdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'); A0 Y+ q9 F, X* q* {
var actualwidth=''
: j2 Y! ^1 V# R$ f# svar cross_marquee, ns_marquee
% Y$ K) f  R$ d5 ^4 c/ U2 ^9 W9 ~% ?/ R% B( F# q
function populate(){
" T* k& a% V" R0 f. i3 Y" u- rif (iedom){- _4 R, P* {: I# y# p
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% |3 ~4 O: ~5 k( `1 z/ l8 O
cross_marquee.style.left=marqueewidth+82 s6 i4 @7 @; `% ^4 B5 B7 u
cross_marquee.innerHTML=marqueecontent2 H5 _( v3 H; D# X
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- H3 f6 ?. u7 Y7 `1 r1 P
}0 U- G4 ~: k1 f7 _' C
else if (document.layers){4 H- P  A% Z; Z* Q2 b
ns_marquee=document.ns_marquee.document.ns_marquee2
: }9 d3 r* \- Xns_marquee.left=marqueewidth+88 f4 b) H* h6 Y
ns_marquee.document.write(marqueecontent)
* K' L& b, l1 a; }& v. ]& i5 o( Yns_marquee.document.close()' z5 C: x) E: _! C7 e+ Q$ M
actualwidth=ns_marquee.document.width0 ^  X) g. A# Z0 U: B7 {
}
$ V) y5 X) [9 [. G% k; W8 plefttime=setInterval("scrollmarquee()",20)( v; I3 h5 C. M$ O' ]1 J
}/ {$ @  X" Y' J: G& M
window.onload=populate8 m6 D* p7 e* W

3 g  |% \: A  `' [: c8 v; Lfunction scrollmarquee(){
& D8 r! B  \' F5 {& mif (iedom){5 h0 C5 v- b/ p8 b+ F
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ X; Y  Z: E! t5 s' \' y! r5 f2 Y( Ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; P6 i+ {# v& Y) E5 I0 E' pelse
8 {% H5 k& N$ P$ J1 Q) p& Kcross_marquee.style.left=marqueewidth+8" @3 X% {) f) R# u
% X0 f4 m' W; `
}: a' y; L# W' U% T
else if (document.layers){4 l9 [* z: o/ U4 E8 v- u
if (ns_marquee.left>(actualwidth*(-1)+8))
7 Z- C( u8 f# D6 sns_marquee.left-=copyspeed* D( s/ f0 d" W; Y  l! |
else; X' t. t) t3 P" O. ]! p
ns_marquee.left=marqueewidth+8: c( O: W8 H2 x; a+ C
}
# k/ R7 S  @- d" i- A: p$ G( M}
6 g* ^8 T8 L& k# }4 J# }) P* x
9 b0 W; M6 P$ Aif (iedom||document.layers){0 c) l- B) z3 z
with (document){
# i( g0 o/ v+ Udocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" Q9 r! c9 H' ~
if (iedom){7 o0 F2 m  ]/ D8 B& N8 P' W
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& ?$ n0 Y6 C3 d% p: X! iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: Q6 [( h9 R  ?, @: Y5 Awrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! F, N) u$ Q& w
write('</div>')
) w% ?, e: I2 z7 |}$ M4 `0 ?6 g  U% f2 @+ \# j, r
else if (document.layers){
2 v9 ]  i( `- g0 q& d$ vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! j/ Y0 M. s+ x; b+ ^' e* Cwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, B. Y, B0 S6 }5 I9 d" uwrite('</ilayer>')( _- p5 N6 n, D% }: l
}! y! D4 K8 S" K9 N
document.write('</td></table>'); I3 U/ Y" V: ~! e" |7 M  p
}
+ z. r: D5 E, R& Z4 {}1 G9 t2 G7 w7 H2 ?8 g: k
</script>

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