返回列表 发帖

网页之跑马灯文字特效

//修改宽度
" q/ }1 K- q; e+ X2 a2 qvar marqueewidth=3001 }5 F, p+ S0 y$ O& m( |8 W
//高度
( W* R  @0 w( X. Z  X/ K" N8 }! zvar marqueeheight=25
: n# {, p6 K7 Q" t3 n; {( q/ K; O//速度(1-10)& b6 U- u% t. I# k  h. z% g
var marqueespeed=3
6 l4 c" m4 N/ @9 ~5 B& W//背景颜色' Y0 G9 t& k8 S2 p# x
var marqueebgcolor="#FFFFFF"
5 Z. C) }& p1 L& J  ?, h( k//是否能暂停 (0=no. 1=yes)?
. k$ B3 f8 s8 `- y# \1 ]1 A6 j( }3 Dvar pauseit=1% I, R- P& g  V1 |3 P( H

. Q" Y  g" }* P/ a- H//修改显示内容8 Q1 p: E  B4 B. V
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'4 n1 k1 E+ n2 b  i4 X5 }
: ]6 X0 F7 X" o/ D8 z

0 c/ j& z* g- M////下面不需改变////////////
, N$ T' w2 e/ \  t0 G( u) Q: V6 U- Q/ M
var copyspeed=marqueespeed- p$ y1 n0 O5 Y
var pausespeed=(pauseit==0)? copyspeed: 0
: S: B: a9 g% n- evar iedom=document.all||document.getElementById; g& \# Z+ q( ~+ ?( o; S% U% q
if (iedom)" S9 y% ?/ Y" t
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" p2 s  t$ z% O  L$ P" M8 g# I, P9 E
var actualwidth=''
: k6 n% q" t8 L/ N8 c3 mvar cross_marquee, ns_marquee
2 \3 b4 ]) Z8 y7 S$ c4 V# o9 Y' C# ]2 s/ R5 ]" N
function populate(){9 K: G( D6 T( ^; E0 N
if (iedom){% w& f3 x6 m9 |. q& C
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
% i- S. R5 m( Y4 Xcross_marquee.style.left=marqueewidth+8
& K* ~( E/ q$ \, {: V! z4 bcross_marquee.innerHTML=marqueecontent- H0 n6 H7 C' q$ t$ s
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth' P3 g- l+ z3 M* O4 Q  F  S5 b9 C/ X  g
}
1 K7 o, {# U; U6 }! helse if (document.layers){$ W- B$ b# j+ f, y/ w* F1 |
ns_marquee=document.ns_marquee.document.ns_marquee2
; E% `  h+ l. a; ~. z$ g2 L6 bns_marquee.left=marqueewidth+8
  b( V4 e5 u/ X" p7 M1 Z+ w# Nns_marquee.document.write(marqueecontent)
6 {: c2 y* Z; O5 Q# ^( ~% Z' mns_marquee.document.close()
' {6 `+ u, D, Y8 zactualwidth=ns_marquee.document.width% ~7 M7 f) B( z  Y1 {
}. k) e. `+ c' r
lefttime=setInterval("scrollmarquee()",20)$ ]+ x+ w6 e# W# F& b+ Z; Z" h
}; o+ D6 S% _9 e- n
window.onload=populate, a( d+ `7 E6 e4 A$ l! t' S' x
( K) ^5 Z9 K, o1 g
function scrollmarquee(){
0 A2 l" P3 H# e5 [/ t+ ]7 r% R4 Dif (iedom){1 O4 s/ y" n; U6 k/ ^
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 ]8 n6 m( W+ |6 Z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed  `% ?* G) V- m' c1 Q
else
9 c/ |2 c( q: ~" c2 f1 O9 ecross_marquee.style.left=marqueewidth+81 H# p6 j$ \& |& l

  r* N* `4 _4 P* l' t, g}
# A* R. n' h! D$ y2 s1 U! O7 `else if (document.layers){1 p3 `% c- k" d- M+ ^
if (ns_marquee.left>(actualwidth*(-1)+8))
% w( |. ]0 n) g) o: N9 uns_marquee.left-=copyspeed" b0 c4 b+ t5 N' p4 b  S3 p
else
& Y) E2 f3 i0 L) X/ `3 ~: K& \  cns_marquee.left=marqueewidth+8
+ e2 E( i2 w6 d/ Y5 _}
& W1 X9 q6 ?* C) X}
% i: J' A+ [6 t- a8 {5 _1 }+ ~5 U9 ^$ v$ J6 V' s! H3 C% X
if (iedom||document.layers){  V/ b$ D0 @" O/ R  t. |! e
with (document){
' J7 y* w: T; k+ Tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) E) s+ J4 |2 B4 N; tif (iedom){
+ G5 O' x3 k5 L# Ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# N9 c- i* ]( ~5 u) v0 f/ ~( |$ k
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' k) P6 U0 E8 B5 Q' c. w9 L
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- b% c& q% x! w% [: Rwrite('</div>')
! R8 j5 S$ U5 C$ A: \9 g( a& R- m& J}# x; y5 y' B. X0 G) C/ C
else if (document.layers){; m) H7 ?. G& d% S  P  \
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). M" c! L) {+ O/ w( e, R9 r
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) h( ?* z7 u8 gwrite('</ilayer>')  ~6 }: E8 R8 r/ P2 }' j$ J
}1 q2 U$ a/ N: A8 M% S: e6 P+ B1 i
document.write('</td></table>'); ]/ o* u4 e. d: g
}
% {: M1 r$ {# A9 e3 I2 T" @1 [}
' Q, P6 L' v$ H$ ~: u: I: Z( L</script>

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